*BSD News Article 89477


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!lucy.swin.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!uunet!in2.uu.net!206.229.87.25!news.sprintlink.net!news-peer.sprintlink.net!news.mathworks.com!news.kei.com!news.thenet.net!wlbr!moe.2bsd.com!sms
From: sms@moe.2bsd.com (Steven M. Schultz)
Subject: LINEHZ, AHZ, accounting, sa(8), lastcomm(1), prof(1) (#366)
Organization: 2BSD, Simi Valley CA USA
Message-ID: <E5qDqM.Gu6@moe.2bsd.com>
Date: Mon, 17 Feb 1997 04:56:46 GMT
Lines: 3207
Xref: euryale.cc.adfa.oz.au comp.bugs.2bsd:739

Subject: LINEHZ, AHZ, accounting, sa(8), lastcomm(1), prof(1) (#366)
Index:	sys/sys,usr.sbin/sa,usr.bin/prof,ucb/lastcomm 2.11BSD

Description:
	In the kernel references to the clock frequency were made by
	referring to 'LINEHZ' in the 'localopts.h' file rather than
	a single global (patchable) variable.  This caused several
	problems:

		1) Configuring multiple kernels with different clock rates
		   would overwrite /usr/include/sys/localopts.h.  Recompiling
		   utilities such as 'lastcomm' or 'sa' while the wrong 
		   localopts.h file was in place would produce erroneous
		   results.

		2) In several drivers timeout factors were calculated as
		   'LINEHZ / 30'.  The intent was to have a 2 "tick" delay
		   and that is what would happen if a 60hz clock were being
		   used.  With a 50hz clock (in Europe for example) the
		   result of LINEHZ/30 is truncated to 1 which can result
		   in no delay at all if the next tick happens immediately.

	ALL references to LINEHZ have been removed from the system and the
	clock frequency informatin is stored in exactly one module.  By
	patching 'hz' and 'mshz' (millisecond/hz) via adb(1) or simply
	editing param.c the clock rate of the kernel can be changed (patching
	on the fly with a running kernel would work if the securelevel of
	the system was 0 or -1).

	There were a couple problems in the process accounting.   The unit
	of time measurement is supposed to be 1/64 of a second.  Way back
	when 2.10BSD was being created the "easy way out" was taken and the
	local clock frequency used instead.  This has been fixed (finally)
	by converting local ticks to 'AHZ' units and setting AHZ equal to
	64 rather than the local clock frequency.  This MEANS that the 
	accounting information is now portable between 50 and 60 hz machines.
	The I/O information was not being scaled by 'AHZ' as it should have
	been (see section 3.9 of the 4.3BSD book).  This also has been fixed.

	sa(8) was (some would say it still is) a mess.  The option parsing was 
	rewritten to use getopt(3) and the standard argument protocol.  The 
	/usr/adm/daily script has been modified to use sa's new argument 
	convention.

	The accounting file was not being rotated and compressed.  This has
	been fixed in /usr/adm/daily.

	About a year and a half ago I received a contribution of some minor
	fixes and updates to the DEQNA/DELQA driver.  These were overlooked
	until now and have finally been incorporated.  

Repeat-By:
	Mostly by observation.  Or recompiling a kernel for another clock
	frequency and forgetting to reset localopts.h back before recompiling
	utilities.

	These changes will make the current accounting files (/usr/adm/
	acct, savacct and usracct) less than believable.  Those files will
	be reinitialized after the new kernel and utilities are in place.

	The changes to 'reboot' are not related to any of the items mentioned
	in the 'Description:' paragraph.  There was a little experiment
	being performed and it was easier to leave the changes in (more
	sync's done is all) than back them out.

Fix:
	The update included below consists of three patch files - the first
	is the ~63kb update to the system sources and the last two are
	"helper" files mentioned below.

	Cut where indicated, saving to a file (/tmp/366) and then:

		sh 366
		patch -p0 < /tmp/366.patch

	Then for each locally configured kernel you need to edit (or simply
	copy /sys/GENERIC/localopts.h) TWO files:  localopts.h and param.c

	You can either 
	
		1) manually edit the two files.  The changes are quite small
		   and you shouldn't have much difficulty seeing the changes
		   by looking at /sys/GENERIC/localopts.h and param.c

		2) use the helper 'patch' scripts (366.p1 and 366.p2) - they
		   *should* work unless you have either a 50hz clock _or_
		   have manually edited/tweeked localopts.h and/or param.c

		   cd /sys/YOUR_KERNEL
		   patch < /tmp/366.localopt.patch
		   patch < /tmp/366.param.c.patch

		   Since these are not context diffs you will be prompted
		   for "File to patch: " - simply answer localopts.h and
		   param.c respectively.

		3) remove /sys/YOUR_KERNEL and reconfigure the kernel:

		   cd /sys/conf
		   ./config YOUR_KERNEL

		   If you save /sys/YOUR_KERNEL/Makefile before deleting the
		   directory you can simply copy it back and not have to
		   reinvent the overlay layout.

	First the affected utilities are recompiled and installed:

		cd /usr/src/usr.bin/prof
		make 
		make install
		make clean

		cd /usr/src/ucb
		rm -f lastcomm
		make lastcomm
		install -s -m 755 -o bin -g bin lastcomm /usr/ucb

		cd /usr/src/usr.sbin/sa
		make 
		make install
		make clean

		cd /usr/src/sbin/reboot
		make 
		make install
		make clean

		cd /usr/src/man/man5
		/usr/man/manroff acct.5 > /usr/man/cat5/acct.0

	Turn off accounting and remove the old files:

		accton
		cp /dev/null /usr/adm/acct
		cp /dev/null /usr/adm/savacct
		cp /dev/null /usr/adm/usracct

	Then the kernel needs to be recompiled:

		cd /sys/YOUR_KERNEL
		make clean
		make
		make install
		reboot

	Lastly the GENERIC kernel should be updated:

		cd /sys/GENERIC
		make clean
		make
		install -m 744 unix /genunix

	Congratulations.  You're done.  Enjoy!

	As always this and previous updates to 2.11BSD are available via
	anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the
	directory /pub/2.11BSD.

--------------------------cut here--------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	/tmp/366.patch
#	/tmp/366.localopts.patch
#	/tmp/366.param.c.patch
# This archive created: Sun Feb 16 17:48:41 1997
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f '/tmp/366.patch'
then
	echo shar: "will not over-write existing file '/tmp/366.patch'"
else
sed 's/^Z//' << \SHAR_EOF > '/tmp/366.patch'
Z*** /usr/adm/daily.old	Sat Nov 16 16:48:41 1996
Z--- /usr/adm/daily	Sat Feb 15 20:52:33 1997
Z***************
Z*** 5,12 ****
Z  msgs -c
Z  
Z  echo ""
Z! echo "Purging accounting records:"
Z! sa -sfv10 > /dev/null
Z  
Z  echo ""
Z  echo "Running calendar:"
Z--- 5,20 ----
Z  msgs -c
Z  
Z  echo ""
Z! echo "Rotating accounting records:"
Z! mv -f /usr/adm/acct.2.Z /usr/adm/acct.3.Z
Z! mv -f /usr/adm/acct.1.Z /usr/adm/acct.2.Z
Z! mv -f /usr/adm/acct.0.Z /usr/adm/acct.1.Z
Z! mv -f /usr/adm/acct /usr/adm/acct.0
Z! cp /dev/null /usr/adm/acct
Z! chmod 644 /usr/adm/acct
Z! accton /usr/adm/acct
Z! sa -s -f -v 10 /usr/adm/acct.0 > /dev/null
Z! compress /usr/adm/acct.0
Z  
Z  echo ""
Z  echo "Running calendar:"
Z*** /usr/src/sys/pdpif/if_qe.c.old	Sat May 20 21:00:25 1995
Z--- /usr/src/sys/pdpif/if_qe.c	Sun Feb 16 12:23:17 1997
Z***************
Z*** 1,4 ****
Z! /*	@(#)if_qe.c	1.2 (2.11BSD) 1995/05/20 */
Z   
Z  /****************************************************************
Z   *								*
Z--- 1,4 ----
Z! /*	@(#)if_qe.c	1.3 (2.11BSD) 1997/2/16 */
Z   
Z  /****************************************************************
Z   *								*
Z***************
Z*** 147,158 ****
Z  #define NXMT	5	 		/* Transmit descriptors		*/
Z  #define NTOT	(NXMT + NRCV)
Z   
Z! /*
Z!  * This constant should really be 60 because the qna adds 4 bytes of crc.
Z!  * However when set to 60 our packets are ignored by deuna's , 3coms are
Z!  * okay ??????????????????????????????????????????
Z!  */
Z! #define MINDATA 64
Z   
Z  /*
Z   * Ethernet software status per interface.
Z--- 147,153 ----
Z  #define NXMT	5	 		/* Transmit descriptors		*/
Z  #define NTOT	(NXMT + NRCV)
Z   
Z! #define MINDATA 60
Z   
Z  /*
Z   * Ethernet software status per interface.
Z***************
Z*** 230,235 ****
Z--- 225,231 ----
Z  	register struct ifnet *ifp = &sc->is_if;
Z  	struct qedevice *addr = (struct qedevice *)ui->ui_addr;
Z  	register int i;
Z+ 	int	islqa = 0;
Z  	extern int nextiv();
Z   
Z  	ifp->if_unit = ui->ui_unit;
Z***************
Z*** 242,247 ****
Z--- 238,250 ----
Z  	 */
Z  	for	( i=0 ; i<6 ; i++ )
Z  		sc->setup_pkt[i][1] = sc->is_addr[i] = addr->qe_sta_addr[i] & 0xff;  
Z+ 	/*
Z+  	 * Determine if this is a DEQNA or a DELQA...
Z+ 	*/
Z+ 	addr->qe_vector |= QE_VEC_ID;
Z+ 	if	(addr->qe_vector & QE_VEC_ID)
Z+ 		islqa = 1;
Z+ 	addr->qe_vector &= ~QE_VEC_ID;
Z   
Z  	/*
Z  	 * Allocate a floating vector and initialize it with the address of
Z***************
Z*** 273,278 ****
Z--- 276,284 ----
Z  	ifp->if_ioctl = qeioctl;
Z  	ifp->if_reset = 0;
Z  	if_attach(ifp);
Z+ 
Z+ 	printf("qe%d: DEC DE%sA addr %s\n",ifp->if_unit, islqa ? "LQ": "QN",
Z+ 		ether_sprintf(&sc->is_addr));
Z  }
Z   
Z  /*
Z***************
Z*** 392,403 ****
Z  		/*
Z  		 *  Does buffer end on odd byte ? 
Z  		 */
Z! 		if( len & 1 ) {
Z  			len++;
Z  			rp->qe_odd_end = 1;
Z  		}
Z- 		if( len < MINDATA )
Z- 			len = MINDATA;
Z  		rp->qe_buf_len = -(len/2);
Z  		rp->qe_flag = rp->qe_status1 = QE_NOTYET;
Z  		rp->qe_addr_lo = loint(buf_addr);
Z--- 398,409 ----
Z  		/*
Z  		 *  Does buffer end on odd byte ? 
Z  		 */
Z! 		if (len < MINDATA)
Z! 			len = MINDATA;
Z! 		if (len & 1) {
Z  			len++;
Z  			rp->qe_odd_end = 1;
Z  		}
Z  		rp->qe_buf_len = -(len/2);
Z  		rp->qe_flag = rp->qe_status1 = QE_NOTYET;
Z  		rp->qe_addr_lo = loint(buf_addr);
Z*** /usr/src/sys/pdpif/if_qereg.h.old	Fri Apr 29 20:09:33 1988
Z--- /usr/src/sys/pdpif/if_qereg.h	Sun Feb 16 11:17:29 1997
Z***************
Z*** 1,4 ****
Z! /*	@(#)if_qereg.h	7.1 (Berkeley) 6/5/86 */
Z  
Z  /* @(#)if_qereg.h	1.2 (ULTRIX) 1/3/85 */
Z   
Z--- 1,4 ----
Z! /*	@(#)if_qereg.h	7.1.1 (2.11BSD) 1997/2/16 */
Z  
Z  /* @(#)if_qereg.h	1.2 (ULTRIX) 1/3/85 */
Z   
Z***************
Z*** 28,37 ****
Z  /* ---------------------------------------------------------------------
Z   * Modification History 
Z   *
Z   *  13 Feb. 84 -- rjl
Z   *
Z   *	Initial version of driver. derived from IL driver.
Z-  * 
Z   * ---------------------------------------------------------------------
Z   */
Z  
Z--- 28,39 ----
Z  /* ---------------------------------------------------------------------
Z   * Modification History 
Z   *
Z+  *  16 Feb. 1997 -- sms
Z+  *	Add DELQA mode select and Identity test bit definitions.
Z+  *
Z   *  13 Feb. 84 -- rjl
Z   *
Z   *	Initial version of driver. derived from IL driver.
Z   * ---------------------------------------------------------------------
Z   */
Z  
Z***************
Z*** 79,84 ****
Z--- 81,89 ----
Z  #define QE_POWERUP	0x1000		/* Tranceiver power on		*/
Z  #define QE_CARRIER	0x2000		/* Carrier detect		*/
Z  #define QE_RCV_INT	0x8000		/* Receiver interrupt		*/
Z+ 
Z+ #define	QE_VEC_MS	0x8000		/* DELQA mode select (1=LQA)	*/
Z+ #define	QE_VEC_ID	0x0001		/* Identity test bit		*/
Z   
Z  /*
Z   * Transmit and receive ring discriptor ---------------------------
Z*** /usr/src/sys/pdpuba/dh.c.old	Thu Dec 15 20:21:31 1994
Z--- /usr/src/sys/pdpuba/dh.c	Fri Feb 14 20:58:06 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dh.c	1.3 (2.11BSD GTE) 11/29/94
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dh.c	1.4 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 45,51 ****
Z  #define	IFLAGS	(EVENP|ODDP)
Z  #endif
Z  
Z! #define	FASTTIMER	(LINEHZ/30)	/* scan rate with silos on */
Z  
Z  /*
Z   * Local variables for the driver
Z--- 45,56 ----
Z  #define	IFLAGS	(EVENP|ODDP)
Z  #endif
Z  
Z! /*
Z!  * Use 2 ticks rather than doing a divide of 'hz' by 30.  The old method
Z!  * would produce a scan rate of 1 tick if the lineclock was 50hz but 2 ticks
Z!  * if the lineclock was 60hz.
Z! */
Z! #define	FASTTIMER	2	/* scan rate with silos on */
Z  
Z  /*
Z   * Local variables for the driver
Z***************
Z*** 142,148 ****
Z  	s = spl5();
Z  	if (timerstarted == 0) {
Z  		timerstarted++;
Z! 		timeout(dhtimer, (caddr_t) 0, LINEHZ);
Z  	}
Z  	if ((dhact&(1<<dh)) == 0) {
Z  		addr->un.dhcsr |= DH_IE;
Z--- 147,153 ----
Z  	s = spl5();
Z  	if (timerstarted == 0) {
Z  		timerstarted++;
Z! 		timeout(dhtimer, (caddr_t) 0, hz);
Z  	}
Z  	if ((dhact&(1<<dh)) == 0) {
Z  		addr->un.dhcsr |= DH_IE;
Z***************
Z*** 594,600 ****
Z  		    dhchars[dh] = 0;
Z  		}
Z  	}
Z! 	timeout(dhtimer, (caddr_t) 0, dhsilos ? FASTTIMER : LINEHZ);
Z  }
Z  
Z  /*
Z--- 599,605 ----
Z  		    dhchars[dh] = 0;
Z  		}
Z  	}
Z! 	timeout(dhtimer, (caddr_t) 0, dhsilos ? FASTTIMER : hz);
Z  }
Z  
Z  /*
Z*** /usr/src/sys/pdpuba/dhu.c.old	Wed Nov 30 21:49:38 1994
Z--- /usr/src/sys/pdpuba/dhu.c	Fri Feb 14 21:02:10 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dhu.c	2.1 (2.11BSD GTE) 11/29/94
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dhu.c	2.2 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 32,37 ****
Z--- 32,38 ----
Z  #include "uba.h"
Z  #include "ubavar.h"
Z  #include "systm.h"
Z+ #include <sys/kernel.h>
Z  
Z  struct	uba_device dhuinfo[NDHU];
Z  
Z***************
Z*** 208,214 ****
Z  
Z  		(void) dhumctl(unit, (long)DHU_OFF, DMSET);
Z  		/* Hold DTR low for 0.5 seconds */
Z! 		timeout(wakeup, (caddr_t) &tp->t_dev, LINEHZ/2);
Z  		sleep((caddr_t) &tp->t_dev, PZERO);
Z  	}
Z  #else
Z--- 209,215 ----
Z  
Z  		(void) dhumctl(unit, (long)DHU_OFF, DMSET);
Z  		/* Hold DTR low for 0.5 seconds */
Z! 		timeout(wakeup, (caddr_t) &tp->t_dev, hz/2);
Z  		sleep((caddr_t) &tp->t_dev, PZERO);
Z  	}
Z  #else
Z*** /usr/src/sys/pdpuba/dhv.c.old	Wed Nov 30 21:49:52 1994
Z--- /usr/src/sys/pdpuba/dhv.c	Fri Feb 14 21:02:38 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dhv.c	2.1 (2.11BSD Berkeley) 11/29/94
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dhv.c	2.2 (2.11BSD Berkeley) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 38,43 ****
Z--- 38,44 ----
Z  #include "uba.h"
Z  #include "ubavar.h"
Z  #include "systm.h"
Z+ #include <sys/kernel.h>
Z  
Z  struct	uba_device dhvinfo[NDHV];
Z  
Z***************
Z*** 209,215 ****
Z  		extern int wakeup();
Z  
Z  		/* Hold DTR low for 0.5 seconds */
Z! 		timeout(wakeup, (caddr_t) &tp->t_dev, LINEHZ/2);
Z  		sleep((caddr_t) &tp->t_dev, PZERO);
Z  	}
Z  	ttyclose(tp);
Z--- 210,216 ----
Z  		extern int wakeup();
Z  
Z  		/* Hold DTR low for 0.5 seconds */
Z! 		timeout(wakeup, (caddr_t) &tp->t_dev, hz/2);
Z  		sleep((caddr_t) &tp->t_dev, PZERO);
Z  	}
Z  	ttyclose(tp);
Z***************
Z*** 353,375 ****
Z  		{
Z  		for	(line = 0; rcnt; line++) rcnt >>= 1;
Z  		dhv_rcnt[line]++;
Z- #ifdef	notnow
Z- /*
Z-  * If 16 or less characters were processed from the silo we drop
Z-  * priority to 4 which will block further DHV interrupts but allow
Z-  * clock and most disc interrupts to occur.  Then a small (~ 1ms)
Z-  * delay is done and the interrupt dismissed.  Best that can be done
Z-  * since delaying for any number of whole clock ticks seems to cause
Z-  * problems.
Z- */
Z- 		if	(line <= 4)
Z- 			{
Z- 			c = spl4();	/* DHV is a spl4 device */
Z- 			delay(1000L);	/* try a 1 ms delay */
Z- 			dhvwait++;
Z- 			splx(c);
Z- 			}
Z- #endif
Z  		}
Z  }
Z  
Z--- 354,359 ----
Z*** /usr/src/sys/pdpuba/dr.c.old	Wed Nov 30 21:34:39 1994
Z--- /usr/src/sys/pdpuba/dr.c	Fri Feb 14 21:03:41 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dr.c	1.4 (2.11BSD GTE) 11/30/94
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dr.c	1.5 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 22,27 ****
Z--- 22,28 ----
Z  #include "conf.h"
Z  #include "ioctl.h"
Z  #include "drreg.h"
Z+ #include <sys/kernel.h>
Z  
Z  struct	dr11w {
Z  	int	i_flags;		/* interface flags */
Z***************
Z*** 71,77 ****
Z  	drptr->i_sig = 0;		/* clear signals (set by ioctl) */
Z  	drptr->i_tsig = 0;
Z  	drptr->i_fun = 0;		/* clear function */
Z! 	timeout(drtimeout, (caddr_t)drptr, LINEHZ);
Z  	return(0);
Z  }
Z  
Z--- 72,78 ----
Z  	drptr->i_sig = 0;		/* clear signals (set by ioctl) */
Z  	drptr->i_tsig = 0;
Z  	drptr->i_fun = 0;		/* clear function */
Z! 	timeout(drtimeout, (caddr_t)drptr, hz);
Z  	return(0);
Z  }
Z  
Z***************
Z*** 311,317 ****
Z  	if(drptr->i_flags & (DR_TACTIVE | DR_OPEN))
Z  	{
Z  		drptr->i_prev = drptr->i_req;	/* arm timeout */
Z! 		timeout(drtimeout, ptr, LINEHZ);
Z  	}
Z  }
Z  
Z--- 312,318 ----
Z  	if(drptr->i_flags & (DR_TACTIVE | DR_OPEN))
Z  	{
Z  		drptr->i_prev = drptr->i_req;	/* arm timeout */
Z! 		timeout(drtimeout, ptr, hz);
Z  	}
Z  }
Z  
Z*** /usr/src/sys/pdpuba/lp.c.old	Tue Nov 29 22:10:02 1994
Z--- /usr/src/sys/pdpuba/lp.c	Fri Feb 14 21:05:01 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)lp.c	1.2 (2.11BSD GTE) 11/29/94
Z   */
Z  
Z  #include "lp.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)lp.c	1.3 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "lp.h"
Z***************
Z*** 91,97 ****
Z  	s = spl4();
Z  	if ((sc->sc_state&TOUT) == 0) {
Z  		sc->sc_state |= TOUT;
Z! 		timeout(lptout, (caddr_t)dev, 10*LINEHZ);
Z  	}
Z  	splx(s);
Z  	lpcanon(dev, '\f');
Z--- 91,97 ----
Z  	s = spl4();
Z  	if ((sc->sc_state&TOUT) == 0) {
Z  		sc->sc_state |= TOUT;
Z! 		timeout(lptout, (caddr_t)dev, 10*hz);
Z  	}
Z  	splx(s);
Z  	lpcanon(dev, '\f');
Z***************
Z*** 282,288 ****
Z  	if ((sc->sc_state&MOD) != 0) {
Z  		sc->sc_state &= ~MOD;		/* something happened */
Z  						/* so don't sweat */
Z! 		timeout(lptout, (caddr_t)dev, 2*LINEHZ);
Z  		return;
Z  	}
Z  	if ((sc->sc_state&OPEN) == 0 && sc->sc_outq.c_cc == 0) {
Z--- 282,288 ----
Z  	if ((sc->sc_state&MOD) != 0) {
Z  		sc->sc_state &= ~MOD;		/* something happened */
Z  						/* so don't sweat */
Z! 		timeout(lptout, (caddr_t)dev, 2*hz);
Z  		return;
Z  	}
Z  	if ((sc->sc_state&OPEN) == 0 && sc->sc_outq.c_cc == 0) {
Z***************
Z*** 293,298 ****
Z  	if (sc->sc_outq.c_cc && (lpaddr->lpcs&LP_RDY) &&
Z  	    (lpaddr->lpcs&LP_ERR)==0)
Z  		lpintr(LPUNIT(dev));			/* ready to go */
Z! 	timeout(lptout, (caddr_t)dev, 10*LINEHZ);
Z  }
Z  #endif
Z--- 293,298 ----
Z  	if (sc->sc_outq.c_cc && (lpaddr->lpcs&LP_RDY) &&
Z  	    (lpaddr->lpcs&LP_ERR)==0)
Z  		lpintr(LPUNIT(dev));			/* ready to go */
Z! 	timeout(lptout, (caddr_t)dev, 10*hz);
Z  }
Z  #endif
Z*** /usr/src/sys/pdpuba/dz.c.old	Wed Nov 30 21:50:20 1994
Z--- /usr/src/sys/pdpuba/dz.c	Fri Feb 14 21:06:11 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dz.c	1.3 (2.11BSD GTE) 11/29/94
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)dz.c	1.4 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 32,38 ****
Z  struct	uba_device dzinfo[NDZ];
Z  
Z  #define	NDZLINE		(NDZ*8)
Z! #define	FASTTIMER	(LINEHZ/30)	/* rate to drain silos, when in use */
Z  
Z  int	dzstart(), dzxint(), dzdma();
Z  int	ttrstrt();
Z--- 32,38 ----
Z  struct	uba_device dzinfo[NDZ];
Z  
Z  #define	NDZLINE		(NDZ*8)
Z! #define	FASTTIMER	2	/* rate to drain silos, when in use */
Z  
Z  int	dzstart(), dzxint(), dzdma();
Z  int	ttrstrt();
Z***************
Z*** 108,114 ****
Z  	}
Z  	if (dz_timer == 0) {
Z  		dz_timer++;
Z! 		timeout(dzscan, (caddr_t)0, LINEHZ);
Z  		dztimerintvl = FASTTIMER;
Z  	}
Z  	return (1);
Z--- 108,114 ----
Z  	}
Z  	if (dz_timer == 0) {
Z  		dz_timer++;
Z! 		timeout(dzscan, (caddr_t)0, hz);
Z  		dztimerintvl = FASTTIMER;
Z  	}
Z  	return (1);
Z***************
Z*** 558,564 ****
Z  	}
Z  	if (dzsilos && !olddzsilos)
Z  		timeout(dztimer, (caddr_t)0, dztimerintvl);
Z! 	timeout(dzscan, (caddr_t)0, LINEHZ);
Z  }
Z  
Z  dztimer()
Z--- 558,564 ----
Z  	}
Z  	if (dzsilos && !olddzsilos)
Z  		timeout(dztimer, (caddr_t)0, dztimerintvl);
Z! 	timeout(dzscan, (caddr_t)0, hz);
Z  }
Z  
Z  dztimer()
Z*** /usr/src/sys/pdpuba/ra.c.old	Mon Oct 30 19:48:46 1995
Z--- /usr/src/sys/pdpuba/ra.c	Fri Feb 14 21:08:46 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)ra.c	3.1 (2.11BSD GTE) 1995/10/28
Z   */
Z  
Z   /***********************************************************************
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)ra.c	3.2 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z   /***********************************************************************
Z***************
Z*** 14,19 ****
Z--- 14,22 ----
Z  
Z  /* 
Z   * ra.c - MSCP Driver
Z+  * Date:	February 14, 1997
Z+  * Use 'hz' to calculate delays rather than compile time constant.
Z+  *
Z   * Date:	October 28, 1995
Z   * Fix multicontroller support (which was badly broken when disklabels were 
Z   * added).  Accessing drives on the second controller would cause serious 
Z***************
Z*** 132,142 ****
Z  #include "errno.h"
Z  #include "file.h"
Z  #include "stat.h"
Z  
Z- #ifndef	offsetof
Z- #define	offsetof(type,member) ((size_t)(&((type *)0)->member))
Z- #endif
Z- 
Z  #define	RACON(x)			((minor(x) >> 6) & 03)
Z  #define	RAUNIT(x)			((minor(x) >> 3) & 07)
Z  
Z--- 135,142 ----
Z  #include "errno.h"
Z  #include "file.h"
Z  #include "stat.h"
Z+ #include <sys/kernel.h>
Z  
Z  #define	RACON(x)			((minor(x) >> 6) & 03)
Z  #define	RAUNIT(x)			((minor(x) >> 3) & 07)
Z  
Z***************
Z*** 370,376 ****
Z  		}
Z  
Z  		/* wait for initialization to complete */
Z! 		timeout(wakeup, (caddr_t)&sc->sc_ctab, 12 * LINEHZ);
Z  		sleep((caddr_t)&sc->sc_ctab, PSWP+1);
Z  		if (sc->sc_state != S_RUN) {
Z  			splx(s);
Z--- 370,376 ----
Z  		}
Z  
Z  		/* wait for initialization to complete */
Z! 		timeout(wakeup, (caddr_t)&sc->sc_ctab, 12 * hz);
Z  		sleep((caddr_t)&sc->sc_ctab, PSWP+1);
Z  		if (sc->sc_state != S_RUN) {
Z  			splx(s);
Z***************
Z*** 412,418 ****
Z  		((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
Z  		normalseg5();
Z  		i = sc->RAADDR->raip;
Z! 		timeout(wakeup, (caddr_t)&disk->ra_flags, 10 * LINEHZ);
Z  		sleep((caddr_t)&disk->ra_flags, PSWP+1);
Z  		splx(s);
Z  	}
Z--- 412,418 ----
Z  		((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
Z  		normalseg5();
Z  		i = sc->RAADDR->raip;
Z! 		timeout(wakeup, (caddr_t)&disk->ra_flags, 10 * hz);
Z  		sleep((caddr_t)&disk->ra_flags, PSWP+1);
Z  		splx(s);
Z  	}
Z*** /usr/src/sys/pdpuba/tm.c.old	Sat Jan 18 16:44:57 1997
Z--- /usr/src/sys/pdpuba/tm.c	Fri Feb 14 21:09:15 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)tm.c	2.3 (2.11BSD GTE) 1997/1/18
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)tm.c	2.4 (2.11BSD GTE) 1997/4/14
Z   */
Z  
Z  /*
Z***************
Z*** 166,172 ****
Z  	if (sc->sc_tact == 0) {
Z  		sc->sc_timo = INF;
Z  		sc->sc_tact = 1;
Z! 		timeout(tmtimer, (caddr_t) dev, 5 * LINEHZ);
Z  	}
Z  	splx(s);
Z  	return(0);
Z--- 166,172 ----
Z  	if (sc->sc_tact == 0) {
Z  		sc->sc_timo = INF;
Z  		sc->sc_tact = 1;
Z! 		timeout(tmtimer, (caddr_t) dev, 5 * hz);
Z  	}
Z  	splx(s);
Z  	return(0);
Z***************
Z*** 583,589 ****
Z  		tmintr();
Z  		splx(s);
Z  	}
Z! 	timeout(tmtimer, (caddr_t) dev, 5 * LINEHZ);
Z  }
Z  
Z  tmseteof(bp)
Z--- 583,589 ----
Z  		tmintr();
Z  		splx(s);
Z  	}
Z! 	timeout(tmtimer, (caddr_t) dev, 5 * hz);
Z  }
Z  
Z  tmseteof(bp)
Z*** /usr/src/sys/conf/README.old	Fri Jan  1 17:58:11 1993
Z--- /usr/src/sys/conf/README	Fri Feb 14 21:10:43 1997
Z***************
Z*** 1,3 ****
Z--- 1,5 ----
Z+ Updated 1997/2/14
Z+ 
Z  	This directory contains prototypes of the files necessary to remaking
Z  the kernel.  The kernel is not compiled or loaded in this directory, but in
Z  individual directories per machine.  To set up a directory for a new machine,
Z***************
Z*** 40,49 ****
Z  you try and remake the old system.  To make this easy, config saves a copy
Z  in the kernel directory.
Z  
Z! Almost no applications depend on localopts.h now, pstat.c, mkfs.c and sa.c 
Z  are the only ones which come to mind.  'pstat' and 'mkfs' need the 
Z! EXTERNALITIMES define and the accounting program 'sa' needs the LINEHZ 
Z! definition.  ALL other options have either been deleted (obsolete) or made
Z  standard.  The few remaining options have been moved into the kernel Makefile
Z  as "-Dxxx" flags to the compiler.  If EXTERNALITIMES changes you will need
Z  to recompile anything which looks at the kernel's incore inode table.
Z--- 42,52 ----
Z  you try and remake the old system.  To make this easy, config saves a copy
Z  in the kernel directory.
Z  
Z! Almost no applications depend on localopts.h now, pstat.c and mkfs.c
Z  are the only ones which come to mind.  'pstat' and 'mkfs' need the 
Z! EXTERNALITIMES define.
Z! 
Z! ALL other options have either been deleted (obsolete) or made
Z  standard.  The few remaining options have been moved into the kernel Makefile
Z  as "-Dxxx" flags to the compiler.  If EXTERNALITIMES changes you will need
Z  to recompile anything which looks at the kernel's incore inode table.
Z*** /usr/src/sys/conf/config.old	Sat Jun  8 22:47:36 1996
Z--- /usr/src/sys/conf/config	Sat Feb 15 22:37:51 1997
Z***************
Z*** 1,6 ****
Z--- 1,11 ----
Z  #! /bin/sh
Z  #	2.11BSD script to set up a new kernel configuration directory.
Z  #
Z+ #	1997/2/14 - LINEHZ removed from localopts.h.  The clock rate is
Z+ #		    now known in _exactly 1_ place in the kernel (param.c)
Z+ #		    rather than having references scattered all over the 
Z+ #		    place.  Patching 'hz' (and 'mshz') will now do the right 
Z+ #		    thing (i.e. change the clock rate on the fly).
Z  #	1996/6/8 - New spl massaging scripts.  They are now 'sed' scripts
Z  #		   rather than 'ed' scripts and are about twice as fast.
Z  #	1995/07/21 - remove XP_PROBE, the kernel no longer probes for disk
Z***************
Z*** 53,59 ****
Z   *
Z   * It contains a list the kernel options not prepended to the Makefile
Z   * as -Dxxxx commands to the compiler.  MAXMEM was moved to param.h leaving
Z!  * only LINEHZ and EXTERNALITIMES to be placed in localopts.h
Z   */
Z  
Z  EOF
Z--- 58,64 ----
Z   *
Z   * It contains a list the kernel options not prepended to the Makefile
Z   * as -Dxxxx commands to the compiler.  MAXMEM was moved to param.h leaving
Z!  * only EXTERNALITIMES to be placed in localopts.h
Z   */
Z  
Z  EOF
Z***************
Z*** 106,111 ****
Z--- 111,117 ----
Z  	-e "s/%DUMPROUTINE%/$DUMPROUTINE/" < ioconf.c > ../$MACHINE/ioconf.c
Z  
Z  sed	-e "s/%TIMEZONE%/$TIMEZONE/" \
Z+ 	-e "s/%LINEHZ%/$LINEHZ/g" \
Z  	-e "s/%DST%/$DST/" \
Z  	-e "s/%NBUF%/$NBUF/" \
Z  	-e "s/%MAXUSERS%/$MAXUSERS/" < param.c > ../$MACHINE/param.c
Z***************
Z*** 113,119 ****
Z  echo "Setting configuration options for $MACHINE."
Z  
Z  OPTS="-D${IDENT}"
Z- echo "#define LINEHZ	$LINEHZ"	>> $LO
Z  if [ $FPSIM = YES ]; then
Z  	OPTS="$OPTS -DFPSIM"
Z  fi
Z--- 119,124 ----
Z*** /usr/src/sys/conf/param.c.old	Wed Jan 18 19:54:06 1995
Z--- /usr/src/sys/conf/param.c	Fri Feb 14 21:22:50 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)param.c	2.1 (2.11BSD GTE) 1/18/95
Z   */
Z  
Z  #include "../h/param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)param.c	2.2 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "../h/param.h"
Z***************
Z*** 35,42 ****
Z  #define	MAXUSERS %MAXUSERS%
Z  #define	NBUF %NBUF%
Z  
Z! int	hz = LINEHZ;
Z  struct	timezone tz = { %TIMEZONE%, %DST% };
Z  #define	NPROC (10 + 7 * MAXUSERS)
Z  int	nproc = NPROC;
Z  #define NTEXT (26 + MAXUSERS)
Z--- 35,44 ----
Z  #define	MAXUSERS %MAXUSERS%
Z  #define	NBUF %NBUF%
Z  
Z! int	hz = %LINEHZ%;
Z! u_short	mshz = (1000000L + %LINEHZ% - 1) / %LINEHZ%;
Z  struct	timezone tz = { %TIMEZONE%, %DST% };
Z+ 
Z  #define	NPROC (10 + 7 * MAXUSERS)
Z  int	nproc = NPROC;
Z  #define NTEXT (26 + MAXUSERS)
Z*** /usr/src/sys/sys/sys_pipe.c.old	Tue Feb  4 20:02:07 1997
Z--- /usr/src/sys/sys/sys_pipe.c	Fri Feb  7 22:34:16 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)sys_pipe.c	1.4 (2.11BSD GTE) 1997/1/30
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)sys_pipe.c	1.5 (2.11BSD GTE) 1997/2/7
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 265,272 ****
Z   * because the inode type was DTYPE_PIPE.  The dispatch in closef() can come
Z   * directly here instead of the general inode close routine.
Z   *
Z!  * This routine frees the inode by calling 'irele'.  The inode must be
Z!  * unlocked prior to calling this routine.
Z  */
Z  
Z  pipe_close(fp)
Z--- 265,273 ----
Z   * because the inode type was DTYPE_PIPE.  The dispatch in closef() can come
Z   * directly here instead of the general inode close routine.
Z   *
Z!  * This routine frees the inode by calling 'iput'.  The inode must be
Z!  * unlocked prior to calling this routine because an 'ilock' is done prior
Z!  * to the select wakeup processing.
Z  */
Z  
Z  pipe_close(fp)
Z***************
Z*** 274,279 ****
Z--- 275,281 ----
Z  	{
Z  	register struct inode *ip = (struct inode *)fp->f_data;
Z  
Z+ 	ilock(ip);
Z  #ifdef	DIAGNOSTIC
Z  	if	((ip->i_flag & IPIPE) == 0)
Z  		panic("pipe_close !IPIPE");
Z***************
Z*** 297,302 ****
Z  /*
Z   * And finally decrement the reference count and (likely) release the inode.
Z   */
Z! 	irele(ip);
Z  	return(0);
Z  	}
Z--- 299,304 ----
Z  /*
Z   * And finally decrement the reference count and (likely) release the inode.
Z   */
Z! 	iput(ip);
Z  	return(0);
Z  	}
Z*** /usr/src/sys/sys/kern_acct.c.old	Sat Jan 18 23:05:26 1997
Z--- /usr/src/sys/sys/kern_acct.c	Sun Feb 16 16:53:50 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_acct.c	2.4 (2.11BSD) 1997/1/18
Z   */
Z  
Z  #include "param.h"
Z--- 3,11 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_acct.c	2.5 (2.11BSD) 1997/2/16
Z!  *
Z!  * This module is a real mishmash of FreeBSD, 4.3BSD, and home brewed code.
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 14,19 ****
Z--- 16,22 ----
Z  #include "user.h"
Z  #include "namei.h"
Z  #include "proc.h"
Z+ #include <sys/file.h>
Z  #include "acct.h"
Z  #include "kernel.h"
Z  #include "syslog.h"
Z***************
Z*** 21,165 ****
Z  /*
Z   * SHOULD REPLACE THIS WITH A DRIVER THAT CAN BE READ TO SIMPLIFY.
Z   */
Z! int	acctsuspend = 2;	/* stop accounting when < 2% free space left */
Z! int	acctresume = 4;		/* resume when free space risen to > 4% */
Z! struct	timeval chk = {15, 0};	/* frequency to check space for accounting */
Z  struct	inode *acctp;
Z! struct	inode *savacctp;
Z  
Z  /*
Z   * Perform process accounting functions.
Z   */
Z  sysacct()
Z! {
Z! 	register struct inode *ip;
Z  	register struct a {
Z  		char	*fname;
Z  	} *uap = (struct a *)u.u_ap;
Z  	struct	nameidata nd;
Z  	register struct nameidata *ndp = &nd;
Z! 	int acctwatch();
Z  
Z! 	if (suser()) {
Z! 		if (savacctp) {
Z! 			acctp = savacctp;
Z! 			savacctp = NULL;
Z  		}
Z! 		if (uap->fname==NULL) {
Z! 			if (ip = acctp) {
Z! 				irele(ip);
Z! 				acctp = NULL;
Z! 				chk.tv_usec = 0;
Z! 				untimeout(acctwatch, &chk);
Z! 			}
Z! 			return;
Z! 		}
Z  		NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, uap->fname);
Z! 		ip = namei(ndp);
Z! 		if (ip == NULL)
Z! 			return;
Z! 		if ((ip->i_mode&IFMT) != IFREG) {
Z! 			u.u_error = EACCES;
Z! 			iput(ip);
Z! 			return;
Z  		}
Z! 		if (ip->i_fs->fs_ronly) {
Z! 			u.u_error = EROFS;
Z! 			iput(ip);
Z! 			return;
Z! 		}
Z! 		if (acctp && (acctp->i_number != ip->i_number ||
Z! 		    acctp->i_dev != ip->i_dev))
Z! 			irele(acctp);
Z! 		acctp = ip;
Z! 		iunlock(ip);
Z! 		if (chk.tv_usec == 0) {
Z! 			chk.tv_usec = 1;	/* usec is timer enabled flag */
Z! 			timeout(acctwatch, &chk, chk.tv_sec * hz);
Z! 		}
Z  	}
Z- }
Z  
Z! acctwatch(resettime)
Z! 	register struct	timeval *resettime;
Z! {
Z  	register struct fs *fs;
Z  
Z! 	if (savacctp) {
Z! 		fs = savacctp->i_fs;
Z! 		if (freespace(fs, acctresume) > 0) {
Z! 			acctp = savacctp;
Z! 			savacctp = NULL;
Z  			log(LOG_NOTICE, "Accounting resumed\n");
Z! /*			return;		/* XXX - fall thru and refresh timer */
Z  		}
Z  	}
Z- 	if (acctp == NULL)
Z- 		return;		/* do not refresh timer */
Z- 	fs = acctp->i_fs;
Z- 	if (freespace(fs, acctsuspend) <= 0) {
Z- 		savacctp = acctp;
Z- 		acctp = NULL;
Z- 		log(LOG_NOTICE, "Accounting suspended\n");
Z- 	}
Z- 	timeout(acctwatch, resettime, resettime->tv_sec * hz);
Z- }
Z  
Z  /*
Z   * On exit, write a record on the accounting file.
Z   */
Z  acct()
Z! {
Z  	struct	acct acctbuf;
Z  	register struct inode *ip;
Z- 	off_t siz;
Z  	register struct acct *ap = &acctbuf;
Z  
Z! 	if ((ip = acctp) == NULL)
Z  		return;
Z  	ilock(ip);
Z  	bcopy(u.u_comm, ap->ac_comm, sizeof(acctbuf.ac_comm));
Z! 	ap->ac_utime = compress(u.u_ru.ru_utime);
Z! 	ap->ac_stime = compress(u.u_ru.ru_stime);
Z! 	ap->ac_etime = compress(time.tv_sec - u.u_start);
Z  	ap->ac_btime = u.u_start;
Z  	ap->ac_uid = u.u_ruid;
Z  	ap->ac_gid = u.u_rgid;
Z  	ap->ac_mem = (u.u_dsize+u.u_ssize) / 16; /* fast ctok() */
Z! 	ap->ac_io = compress(u.u_ru.ru_inblock + u.u_ru.ru_oublock);
Z! 	if (u.u_ttyp)
Z  		ap->ac_tty = u.u_ttyd;
Z  	else
Z  		ap->ac_tty = NODEV;
Z  	ap->ac_flag = u.u_acflag;
Z! 	siz = ip->i_size;
Z! 	u.u_error = rdwri(UIO_WRITE, ip, ap, sizeof(acctbuf), siz,
Z  			UIO_SYSSPACE, IO_UNIT|IO_APPEND, (int *)0);
Z! 	if (u.u_error)
Z! 		itrunc(ip, (u_long)siz, 0);
Z  	iunlock(ip);
Z! }
Z  
Z  /*
Z!  * Produce a pseudo-floating point representation
Z!  * with 3 bits base-8 exponent, 13 bits fraction.
Z   */
Z- compress(t)
Z- register time_t t;
Z- {
Z- 	register exp = 0, round = 0;
Z  
Z! 	while (t >= 8192) {
Z! 		exp++;
Z! 		round = t&04L;
Z! 		t >>= 3;
Z  	}
Z! 	if (round) {
Z! 		t++;
Z! 		if (t >= 8192) {
Z! 			t >>= 3;
Z! 			exp++;
Z! 		}
Z  	}
Z- 	return((exp<<13) + t);
Z- }
Z--- 24,218 ----
Z  /*
Z   * SHOULD REPLACE THIS WITH A DRIVER THAT CAN BE READ TO SIMPLIFY.
Z   */
Z! short	acctsuspend = 2;	/* stop accounting when < 2% free space left */
Z! short	acctresume = 4;		/* resume when free space risen to > 4% */
Z! short	acctchkfreq = 15;	/* frequency to check space for accounting */
Z! short	acctdisabled = 0;	/* 0 = not disabled */
Z  struct	inode *acctp;
Z! comp_t	compress();
Z! static	int	chkfreesp();
Z  
Z  /*
Z   * Perform process accounting functions.
Z   */
Z  sysacct()
Z! 	{
Z! 	register struct inode *ip = NULL;
Z  	register struct a {
Z  		char	*fname;
Z  	} *uap = (struct a *)u.u_ap;
Z  	struct	nameidata nd;
Z  	register struct nameidata *ndp = &nd;
Z! 	int	error;
Z  
Z! 	if	(!suser())
Z! 		{
Z! 		error = u.u_error;	/* XXX */
Z! 		goto out;
Z  		}
Z! /*
Z!  * If accounting is to be started to a file, "open" that file for
Z!  * writing.  We don't check that the file is 'normal' because while it may
Z!  * be strange to write to a tape or (unmounted) disk why should it be
Z!  * prohibited?
Z! */
Z! 	if	(uap->fname != NULL)
Z! 		{
Z  		NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, uap->fname);
Z! 		if	((error = vn_open(ndp, FFLAGS(O_WRONLY), 0)) != 0)
Z! 			goto	out;
Z! 		ip = ndp->ni_ip;
Z  		}
Z! /*
Z!  * Swap the accounting files.
Z! */
Z! 	error = swapacctf(ip);
Z! 
Z! out:
Z! 	return(u.u_error = error);
Z  	}
Z  
Z! /*
Z!  * This was broken out into a function of its own so that it could be 
Z!  * called from elsewhere in the kernel.  The experiment that was done for
Z!  * didn't work out but it doesn't hurt anything to retain this function 
Z!  * (it might come in handy in the future).
Z! */
Z! swapacctf(ip)
Z! 	register struct inode *ip;
Z! 	{
Z! 	register struct inode *oacctp;
Z! 
Z! 	oacctp = acctp;
Z! 	acctp = ip;
Z! 	if	(oacctp)
Z! 		(void)vn_close(oacctp, FWRITE);
Z! 	if	(acctp)
Z! 		acctwatch();
Z! 	return(0);
Z! 	}
Z! 
Z! acctwatch()
Z! 	{
Z  	register struct fs *fs;
Z+ 	static	time_t	acctchecktime;
Z  
Z! 	if	(acctp == NULL || time.tv_sec < acctchecktime)
Z! 		return;		/* do not refresh timer */
Z! 	acctchecktime = time.tv_sec + acctchkfreq;
Z! 	fs = acctp->i_fs;
Z! 
Z! 	if	(acctdisabled)
Z! 		{
Z! 		if	(chkfreesp(fs, acctresume) > 0)
Z! 			{
Z! 			acctdisabled = 0;
Z  			log(LOG_NOTICE, "Accounting resumed\n");
Z! 			}
Z  		}
Z+ 	else
Z+ 		{
Z+ 		if	(chkfreesp(fs, acctsuspend) <= 0)
Z+ 			{
Z+ 			log(LOG_NOTICE, "Accounting suspended\n");
Z+ 			acctdisabled = 1;
Z+ 			}
Z+ 		}
Z  	}
Z  
Z  /*
Z   * On exit, write a record on the accounting file.
Z   */
Z  acct()
Z! 	{
Z  	struct	acct acctbuf;
Z  	register struct inode *ip;
Z  	register struct acct *ap = &acctbuf;
Z  
Z! 	acctwatch();
Z! 
Z! 	if	((ip = acctp) == NULL || acctdisabled)
Z  		return;
Z  	ilock(ip);
Z  	bcopy(u.u_comm, ap->ac_comm, sizeof(acctbuf.ac_comm));
Z! /*
Z!  * The 'user' and 'system' times need to be converted from 'hz' (linefrequency)
Z!  * clockticks to the AHZ pseudo-tick unit of measure.  The elapsed time is
Z!  * converted from seconds to AHZ ticks.
Z! */
Z! 	ap->ac_utime = compress(((u_long)u.u_ru.ru_utime * AHZ) / hz);
Z! 	ap->ac_stime = compress(((u_long)u.u_ru.ru_stime * AHZ) / hz);
Z! 	ap->ac_etime = compress((u_long)(time.tv_sec - u.u_start) * AHZ);
Z  	ap->ac_btime = u.u_start;
Z  	ap->ac_uid = u.u_ruid;
Z  	ap->ac_gid = u.u_rgid;
Z  	ap->ac_mem = (u.u_dsize+u.u_ssize) / 16; /* fast ctok() */
Z! /*
Z!  * Section 3.9 of the 4.3BSD book says that I/O is measured in 1/AHZ units too.
Z! */
Z! 	ap->ac_io = compress((u_long)(u.u_ru.ru_inblock+u.u_ru.ru_oublock)*AHZ);
Z! 	if	(u.u_ttyp)
Z  		ap->ac_tty = u.u_ttyd;
Z  	else
Z  		ap->ac_tty = NODEV;
Z  	ap->ac_flag = u.u_acflag;
Z! 	u.u_error = rdwri(UIO_WRITE, ip, ap, sizeof(acctbuf), ip->i_size,
Z  			UIO_SYSSPACE, IO_UNIT|IO_APPEND, (int *)0);
Z! 	if	(u.u_error)
Z! 		{
Z! /*
Z!  * The only time this should happen is when a physical error occurs on the
Z!  *  disk drive or the space is exhausted.  The diagnostic message is not
Z!  * enabled by default to save space and also because there's apparently a
Z!  * race condition during 'reboot'/'fastboot' that would elicit the (harmless
Z!  * I hope) warning message.
Z! */
Z! 		acctdisabled = 1;
Z! #ifdef	DIAGNOSTIC
Z! 		log(LOG_NOTICE, "acct rdwri=%d\n", u.u_error);
Z! #endif
Z! 		}
Z  	iunlock(ip);
Z! 	}
Z  
Z  /*
Z!  * Raise exponent and drop bits off the right of the mantissa until the
Z!  * mantissa fits.  If we run out of exponent space, return max value (all
Z!  * one bits).  With AHZ set to 64 this is good for close to 8.5 years:
Z!  * (8191 * (1 << (3*7)) / 64 / 60 / 60 / 24 / 365 ~= 8.5)
Z   */
Z  
Z! #define	MANTSIZE	13			/* 13 bit mantissa. */
Z! #define	EXPSIZE		3			/* Base 8 (3 bit) exponent. */
Z! 
Z! comp_t
Z! compress(mant)
Z! 	u_long mant;
Z! 	{
Z! 	register int exp;
Z! 
Z! 	for	(exp = 0; exp < (1 << EXPSIZE); exp++, mant >>= EXPSIZE)
Z! 		if	(mant < (1L << MANTSIZE))
Z! 			return(mant | (exp << MANTSIZE));
Z! 	return(~0);
Z  	}
Z! 
Z! /*
Z!  * A helper function since freespace's generated code is so voluminous.  All
Z!  * we really want is an indication if there is the desired amount of space
Z!  * available (greater than or equal, less than zero).
Z! */
Z! static int
Z! chkfreesp(fs, percent)
Z! 	register struct fs *fs;
Z! 	int	percent;
Z! 	{
Z! 	daddr_t	l;
Z! 
Z! 	l = freespace(fs, percent);
Z! 	if	(l < 0)
Z! 		return(-1);
Z! 	else if	(l == 0)
Z! 		return(0);
Z! 	return(1);
Z  	}
Z*** /usr/src/sys/sys/kern_sysctl.c.old	Sat Jan 18 23:13:27 1997
Z--- /usr/src/sys/sys/kern_sysctl.c	Fri Feb 14 21:26:08 1997
Z***************
Z*** 33,39 ****
Z   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Z   * SUCH DAMAGE.
Z   *
Z!  *	@(#)kern_sysctl.c	8.4.5 (2.11BSD GTE) 1997/1/18
Z   */
Z  
Z  /*
Z--- 33,39 ----
Z   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Z   * SUCH DAMAGE.
Z   *
Z!  *	@(#)kern_sysctl.c	8.4.6 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 746,752 ****
Z  	 * Construct clockinfo structure.
Z  	*/
Z  	clkinfo.hz = hz;
Z! 	clkinfo.tick = 1000000L / hz;
Z  	clkinfo.profhz = 0;
Z  	clkinfo.stathz = hz;
Z  	return(sysctl_rdstruct(where, sizep, NULL, &clkinfo, sizeof (clkinfo)));
Z--- 746,752 ----
Z  	 * Construct clockinfo structure.
Z  	*/
Z  	clkinfo.hz = hz;
Z! 	clkinfo.tick = mshz;
Z  	clkinfo.profhz = 0;
Z  	clkinfo.stathz = hz;
Z  	return(sysctl_rdstruct(where, sizep, NULL, &clkinfo, sizeof (clkinfo)));
Z*** /usr/src/sys/sys/init_main.c.old	Sat Jan 18 22:20:46 1997
Z--- /usr/src/sys/sys/init_main.c	Fri Feb 14 21:28:24 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)init_main.c	2.2 (2.11BSD GTE) 1997/1/18
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)init_main.c	2.3 (2.11BSD GTE) 1997/2/24
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 208,214 ****
Z--- 208,217 ----
Z  	if (netoff = netinit())
Z  		printf("netinit failed\n");
Z  	else
Z+ 		{
Z+ 		NETSETHZ();
Z  		NETSTART();
Z+ 		}
Z  #endif
Z  
Z  /*
Z*** /usr/src/sys/sys/sys_net.c.old	Mon Oct  9 23:03:39 1995
Z--- /usr/src/sys/sys/sys_net.c	Sun Feb 16 12:27:46 1997
Z***************
Z*** 3,10 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)sys_net.c	1.4 (2.11BSD GTE) 1995/10/09
Z   *
Z   * Change uiomove calling convention.  The r/w type is now encapsulated
Z   * in the uio structure now. sms - 11/26/94
Z   *
Z--- 3,15 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)sys_net.c	1.5 (2.11BSD GTE) 1997/2/16
Z   *
Z+  * Print the csr of attached ethernet cards.  sms - 1997/2/16
Z+  *
Z+  * Initialize the supervisor mode 'hz' variable via a call from the kernel
Z+  * rather compiling in a constant. sms - 1997/2/14
Z+  *
Z   * Change uiomove calling convention.  The r/w type is now encapsulated
Z   * in the uio structure now. sms - 11/26/94
Z   *
Z***************
Z*** 110,119 ****
Z  	NULL,
Z  };
Z  
Z! int hz = LINEHZ;
Z! 
Z  long startnet;			/* start of network data space */
Z  
Z  netstart()
Z  {
Z  	extern memaddr miobase, miostart, netdata;
Z--- 115,131 ----
Z  	NULL,
Z  };
Z  
Z! int hz;				/* kernel calls netsethz() to initialize */
Z  long startnet;			/* start of network data space */
Z  
Z+ void
Z+ netsethz(ticks)
Z+ 	int	ticks;
Z+ 	{
Z+ 
Z+ 	hz = ticks;
Z+ 	}
Z+ 
Z  netstart()
Z  {
Z  	extern memaddr miobase, miostart, netdata;
Z***************
Z*** 122,127 ****
Z--- 134,140 ----
Z  	register struct uba_driver *udp;
Z  	register struct uba_device *ui = ubdinit;
Z  	register int s;
Z+ 	char	*attaching = "attaching ";
Z  	int first;
Z  	struct ubmap *ubp;
Z  	ubadr_t paddr;
Z***************
Z*** 166,183 ****
Z  			continue;
Z  		ui->ui_alive = 1;
Z  		udp->ud_dinfo[ui->ui_unit] = ui;
Z! 		printf("attaching %s%d\n", udp->ud_dname, ui->ui_unit);
Z  		(*udp->ud_attach)(ui);
Z  	}
Z  #include "sl.h"
Z  #if NSL > 0
Z! 	printf("attaching sl\n");
Z  	slattach();
Z  #endif
Z  
Z  #include "loop.h"
Z  #if NLOOP > 0
Z! 	printf("attaching lo0\n");
Z  	loattach();
Z  #endif
Z  
Z--- 179,197 ----
Z  			continue;
Z  		ui->ui_alive = 1;
Z  		udp->ud_dinfo[ui->ui_unit] = ui;
Z! 		printf("%s%s%d csr %o\n", attaching,udp->ud_dname,ui->ui_unit, 
Z! 			ui->ui_addr);
Z  		(*udp->ud_attach)(ui);
Z  	}
Z  #include "sl.h"
Z  #if NSL > 0
Z! 	printf("%ssl\n", attaching);
Z  	slattach();
Z  #endif
Z  
Z  #include "loop.h"
Z  #if NLOOP > 0
Z! 	printf("%slo0\n", attaching);
Z  	loattach();
Z  #endif
Z  
Z*** /usr/src/sys/sys/kern_time.c.old	Fri Dec 31 23:28:54 1993
Z--- /usr/src/sys/sys/kern_time.c	Fri Feb 14 21:53:14 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_time.c	1.3 (2.11BSD GTE) 12/31/93
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_time.c	1.4 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 34,40 ****
Z  		 * easier to do it here.  Long casts are out of paranoia.
Z  		 */
Z  		s = splhigh(); atv = time; ms = lbolt; splx(s);
Z! 		atv.tv_usec = (long)ms * 1000000L / (long)LINEHZ;
Z  		u.u_error = copyout((caddr_t)&atv, (caddr_t)(uap->tp),
Z  			sizeof(atv));
Z  		if (u.u_error)
Z--- 34,40 ----
Z  		 * easier to do it here.  Long casts are out of paranoia.
Z  		 */
Z  		s = splhigh(); atv = time; ms = lbolt; splx(s);
Z! 		atv.tv_usec = (long)ms * mshz;
Z  		u.u_error = copyout((caddr_t)&atv, (caddr_t)(uap->tp),
Z  			sizeof(atv));
Z  		if (u.u_error)
Z***************
Z*** 79,85 ****
Z  /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
Z  	boottime.tv_sec += tv->tv_sec - time.tv_sec;
Z  	s = splhigh();
Z! 	time = *tv; lbolt = time.tv_usec / (1000000L / LINEHZ);
Z  	splx(s);
Z  #ifndef pdp11
Z  	/*
Z--- 79,85 ----
Z  /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
Z  	boottime.tv_sec += tv->tv_sec - time.tv_sec;
Z  	s = splhigh();
Z! 	time = *tv; lbolt = time.tv_usec / mshz;
Z  	splx(s);
Z  #ifndef pdp11
Z  	/*
Z***************
Z*** 105,118 ****
Z  		sizeof (struct timeval));
Z  	if (u.u_error)
Z  		return;
Z! 	adjust = atv.tv_sec * LINEHZ + atv.tv_usec / (1000000L / LINEHZ);
Z  	/* if unstoreable values, just set the clock */
Z  	if (adjust > 0x7fff || adjust < 0x8000) {
Z  		s = splclock();
Z  		time.tv_sec += atv.tv_sec;
Z! 		lbolt += atv.tv_usec / (1000000L / LINEHZ);
Z! 		while (lbolt >= LINEHZ) {
Z! 			lbolt -= LINEHZ;
Z  			++time.tv_sec;
Z  		}
Z  		splx(s);
Z--- 105,118 ----
Z  		sizeof (struct timeval));
Z  	if (u.u_error)
Z  		return;
Z! 	adjust = (atv.tv_sec * hz) + (atv.tv_usec / mshz);
Z  	/* if unstoreable values, just set the clock */
Z  	if (adjust > 0x7fff || adjust < 0x8000) {
Z  		s = splclock();
Z  		time.tv_sec += atv.tv_sec;
Z! 		lbolt += atv.tv_usec / mshz;
Z! 		while (lbolt >= hz) {
Z! 			lbolt -= hz;
Z  			++time.tv_sec;
Z  		}
Z  		splx(s);
Z***************
Z*** 124,131 ****
Z  			adjdelta = adjust;
Z  			return;
Z  		}
Z! 		atv.tv_sec = adjdelta / LINEHZ;
Z! 		atv.tv_usec = (adjdelta % LINEHZ) * (1000000L / LINEHZ);
Z  		adjdelta = adjust;
Z  	}
Z  	(void) copyout((caddr_t)&atv, (caddr_t)uap->olddelta,
Z--- 124,131 ----
Z  			adjdelta = adjust;
Z  			return;
Z  		}
Z! 		atv.tv_sec = adjdelta / hz;
Z! 		atv.tv_usec = (adjdelta % hz) * mshz;
Z  		adjdelta = adjust;
Z  	}
Z  	(void) copyout((caddr_t)&atv, (caddr_t)uap->olddelta,
Z***************
Z*** 157,164 ****
Z  	else {
Z  		register struct k_itimerval *t = &u.u_timer[uap->which - 1];
Z  
Z! 		aitv.it_interval.tv_sec = t->it_interval / LINEHZ;
Z! 		aitv.it_value.tv_sec = t->it_value / LINEHZ;
Z  	}
Z  	splx(s);
Z  	u.u_error = copyout((caddr_t)&aitv, (caddr_t)uap->itv,
Z--- 157,164 ----
Z  	else {
Z  		register struct k_itimerval *t = &u.u_timer[uap->which - 1];
Z  
Z! 		aitv.it_interval.tv_sec = t->it_interval / hz;
Z! 		aitv.it_value.tv_sec = t->it_value / hz;
Z  	}
Z  	splx(s);
Z  	u.u_error = copyout((caddr_t)&aitv, (caddr_t)uap->itv,
Z***************
Z*** 204,215 ****
Z  	else {
Z  		register struct k_itimerval *t = &u.u_timer[uap->which - 1];
Z  
Z! 		t->it_value = aitv.it_value.tv_sec * LINEHZ;
Z  		if (aitv.it_value.tv_usec)
Z! 			t->it_value += LINEHZ;
Z! 		t->it_interval = aitv.it_interval.tv_sec * LINEHZ;
Z  		if (aitv.it_interval.tv_usec)
Z! 			t->it_interval += LINEHZ;
Z  	}
Z  	splx(s);
Z  }
Z--- 204,215 ----
Z  	else {
Z  		register struct k_itimerval *t = &u.u_timer[uap->which - 1];
Z  
Z! 		t->it_value = aitv.it_value.tv_sec * hz;
Z  		if (aitv.it_value.tv_usec)
Z! 			t->it_value += hz;
Z! 		t->it_interval = aitv.it_interval.tv_sec * hz;
Z  		if (aitv.it_interval.tv_usec)
Z! 			t->it_interval += hz;
Z  	}
Z  	splx(s);
Z  }
Z***************
Z*** 254,260 ****
Z  			usec -= itp->it_value.tv_usec;
Z  			goto expire;
Z  		}
Z! 		itp->it_value.tv_usec += 1000000;
Z  		itp->it_value.tv_sec--;
Z  	}
Z  	itp->it_value.tv_usec -= usec;
Z--- 254,260 ----
Z  			usec -= itp->it_value.tv_usec;
Z  			goto expire;
Z  		}
Z! 		itp->it_value.tv_usec += 1000000L;
Z  		itp->it_value.tv_sec--;
Z  	}
Z  	itp->it_value.tv_usec -= usec;
Z***************
Z*** 311,320 ****
Z  
Z  	if (t1->tv_usec < 0) {
Z  		t1->tv_sec--;
Z! 		t1->tv_usec += 1000000;
Z  	}
Z! 	if (t1->tv_usec >= 1000000) {
Z  		t1->tv_sec++;
Z! 		t1->tv_usec -= 1000000;
Z  	}
Z  }
Z--- 311,320 ----
Z  
Z  	if (t1->tv_usec < 0) {
Z  		t1->tv_sec--;
Z! 		t1->tv_usec += 1000000L;
Z  	}
Z! 	if (t1->tv_usec >= 1000000L) {
Z  		t1->tv_sec++;
Z! 		t1->tv_usec -= 1000000L;
Z  	}
Z  }
Z*** /usr/src/sys/sys/kern_resource.c.old	Wed Mar 10 23:08:51 1993
Z--- /usr/src/sys/sys/kern_resource.c	Fri Feb 14 21:59:41 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_resource.c	1.3 (2.11BSD GTE) 3/10/93
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_resource.c	1.4 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 165,178 ****
Z  		 * 2.11 stores RLIMIT_CPU as ticks to keep from making
Z  		 * hardclock() do long multiplication/division.
Z  		 */
Z! 		if (alim.rlim_cur >= RLIM_INFINITY / LINEHZ)
Z  			alim.rlim_cur = RLIM_INFINITY;
Z  		else
Z! 			alim.rlim_cur = alim.rlim_cur * LINEHZ;
Z! 		if (alim.rlim_max >= RLIM_INFINITY / LINEHZ)
Z  			alim.rlim_max = RLIM_INFINITY;
Z  		else
Z! 			alim.rlim_max = alim.rlim_max * LINEHZ;
Z  	}
Z  	if (alim.rlim_cur > alimp->rlim_max || alim.rlim_max > alimp->rlim_max)
Z  		if (!suser())
Z--- 165,178 ----
Z  		 * 2.11 stores RLIMIT_CPU as ticks to keep from making
Z  		 * hardclock() do long multiplication/division.
Z  		 */
Z! 		if (alim.rlim_cur >= RLIM_INFINITY / hz)
Z  			alim.rlim_cur = RLIM_INFINITY;
Z  		else
Z! 			alim.rlim_cur = alim.rlim_cur * hz;
Z! 		if (alim.rlim_max >= RLIM_INFINITY / hz)
Z  			alim.rlim_max = RLIM_INFINITY;
Z  		else
Z! 			alim.rlim_max = alim.rlim_max * hz;
Z  	}
Z  	if (alim.rlim_cur > alimp->rlim_max || alim.rlim_max > alimp->rlim_max)
Z  		if (!suser())
Z***************
Z*** 196,204 ****
Z  
Z  		alim = u.u_rlimit[uap->which];
Z  		if (alim.rlim_cur != RLIM_INFINITY)
Z! 			alim.rlim_cur = alim.rlim_cur / LINEHZ;
Z  		if (alim.rlim_max != RLIM_INFINITY)
Z! 			alim.rlim_max = alim.rlim_max / LINEHZ;
Z  		u.u_error = copyout((caddr_t)&alim,
Z  		    (caddr_t)uap->rlp,sizeof (struct rlimit));
Z  	}
Z--- 196,204 ----
Z  
Z  		alim = u.u_rlimit[uap->which];
Z  		if (alim.rlim_cur != RLIM_INFINITY)
Z! 			alim.rlim_cur = alim.rlim_cur / hz;
Z  		if (alim.rlim_max != RLIM_INFINITY)
Z! 			alim.rlim_max = alim.rlim_max / hz;
Z  		u.u_error = copyout((caddr_t)&alim,
Z  		    (caddr_t)uap->rlp,sizeof (struct rlimit));
Z  	}
Z***************
Z*** 257,266 ****
Z  	register struct k_rusage	*krup;
Z  {
Z  	bzero((caddr_t)rup, sizeof(*rup));
Z! 	rup->ru_utime.tv_sec   = krup->ru_utime / LINEHZ;
Z! 	rup->ru_utime.tv_usec  = (krup->ru_utime % LINEHZ * 1000000) / LINEHZ;
Z! 	rup->ru_stime.tv_sec   = krup->ru_stime / LINEHZ;
Z! 	rup->ru_stime.tv_usec  = (krup->ru_stime % LINEHZ * 1000000) / LINEHZ;
Z  	rup->ru_ovly = krup->ru_ovly;
Z  	rup->ru_nswap = krup->ru_nswap;
Z  	rup->ru_inblock = krup->ru_inblock;
Z--- 257,266 ----
Z  	register struct k_rusage	*krup;
Z  {
Z  	bzero((caddr_t)rup, sizeof(*rup));
Z! 	rup->ru_utime.tv_sec   = krup->ru_utime / hz;
Z! 	rup->ru_utime.tv_usec  = (krup->ru_utime % hz) * mshz;
Z! 	rup->ru_stime.tv_sec   = krup->ru_stime / hz;
Z! 	rup->ru_stime.tv_usec  = (krup->ru_stime % hz) * mshz;
Z  	rup->ru_ovly = krup->ru_ovly;
Z  	rup->ru_nswap = krup->ru_nswap;
Z  	rup->ru_inblock = krup->ru_inblock;
Z*** /usr/src/sys/sys/kern_synch.c.old	Fri Mar 12 18:49:46 1993
Z--- /usr/src/sys/sys/kern_synch.c	Fri Feb 14 22:00:29 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_synch.c	1.2 (2.11BSD GTE) 1/1/93
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_synch.c	1.3 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 68,74 ****
Z  		wakeup((caddr_t)&runin);
Z  	}
Z  	++runrun;			/* swtch at least once a second */
Z! 	timeout(schedcpu, (caddr_t)0, LINEHZ);
Z  }
Z  
Z  /*
Z--- 68,74 ----
Z  		wakeup((caddr_t)&runin);
Z  	}
Z  	++runrun;			/* swtch at least once a second */
Z! 	timeout(schedcpu, (caddr_t)0, hz);
Z  }
Z  
Z  /*
Z*** /usr/src/sys/sys/kern_clock.c.old	Fri Dec 31 23:28:25 1993
Z--- /usr/src/sys/sys/kern_clock.c	Fri Feb 14 22:01:23 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_clock.c	1.3 (2.11BSD GTE) 12/31/93
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_clock.c	1.4 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 107,113 ****
Z  			psignal(p, SIGXCPU);
Z  			if (u.u_rlimit[RLIMIT_CPU].rlim_cur <
Z  			    u.u_rlimit[RLIMIT_CPU].rlim_max)
Z! 				u.u_rlimit[RLIMIT_CPU].rlim_cur += 5 * LINEHZ;
Z  		}
Z  		if (u.u_timer[ITIMER_PROF - 1].it_value &&
Z  		    !--u.u_timer[ITIMER_PROF - 1].it_value) {
Z--- 107,113 ----
Z  			psignal(p, SIGXCPU);
Z  			if (u.u_rlimit[RLIMIT_CPU].rlim_cur <
Z  			    u.u_rlimit[RLIMIT_CPU].rlim_max)
Z! 				u.u_rlimit[RLIMIT_CPU].rlim_cur += 5 * hz;
Z  		}
Z  		if (u.u_timer[ITIMER_PROF - 1].it_value &&
Z  		    !--u.u_timer[ITIMER_PROF - 1].it_value) {
Z***************
Z*** 134,141 ****
Z  			--lbolt;
Z  			++adjdelta;
Z  		}
Z! 	if (++lbolt >= LINEHZ) {
Z! 		lbolt -= LINEHZ;
Z  		++time.tv_sec;
Z  	}
Z  
Z--- 134,141 ----
Z  			--lbolt;
Z  			++adjdelta;
Z  		}
Z! 	if (++lbolt >= hz) {
Z! 		lbolt -= hz;
Z  		++time.tv_sec;
Z  	}
Z  
Z***************
Z*** 250,256 ****
Z  		 */
Z  
Z  		if (p->p_uid && p->p_nice == NZERO &&
Z! 		    u.u_ru.ru_utime > 10L * 60L * LINEHZ) {
Z  			p->p_nice = NZERO+4;
Z  				(void) setpri(p);
Z  		}
Z--- 250,256 ----
Z  		 */
Z  
Z  		if (p->p_uid && p->p_nice == NZERO &&
Z! 		    u.u_ru.ru_utime > 10L * 60L * hz) {
Z  			p->p_nice = NZERO+4;
Z  				(void) setpri(p);
Z  		}
Z*** /usr/src/sys/sys/sys_generic.c.old	Thu Jan 30 14:49:22 1997
Z--- /usr/src/sys/sys/sys_generic.c	Fri Feb 14 22:03:46 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)sys_generic.c	1.5 (2.11BSD GTE) 1997/1/30
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)sys_generic.c	1.6 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 324,330 ****
Z  			goto done;
Z  		}
Z  		s = splhigh();
Z! 		time.tv_usec = lbolt * 1000000L / LINEHZ;
Z  		timevaladd(&atv, &time);
Z  		splx(s);
Z  	}
Z--- 324,330 ----
Z  			goto done;
Z  		}
Z  		s = splhigh();
Z! 		time.tv_usec = lbolt * mshz;
Z  		timevaladd(&atv, &time);
Z  		splx(s);
Z  	}
Z***************
Z*** 337,343 ****
Z  	s = splhigh();
Z  	/* this should be timercmp(&time, &atv, >=) */
Z  	if (uap->tv && (time.tv_sec > atv.tv_sec || (time.tv_sec == atv.tv_sec
Z! 	    && lbolt * 1000000L / LINEHZ >= atv.tv_usec))) {
Z  		splx(s);
Z  		goto done;
Z  	}
Z--- 337,343 ----
Z  	s = splhigh();
Z  	/* this should be timercmp(&time, &atv, >=) */
Z  	if (uap->tv && (time.tv_sec > atv.tv_sec || (time.tv_sec == atv.tv_sec
Z! 	    && lbolt * mshz >= atv.tv_usec))) {
Z  		splx(s);
Z  		goto done;
Z  	}
Z*** /usr/src/sys/h/localopts.h.old	Tue Jan 21 20:07:41 1997
Z--- /usr/src/sys/h/localopts.h	Fri Feb 14 21:40:33 1997
Z***************
Z*** 3,10 ****
Z   *
Z   * It contains a list the kernel options not prepended to the Makefile
Z   * as -Dxxxx commands to the compiler.  MAXMEM was moved to param.h leaving
Z!  * only LINEHZ and EXTERNALITIMES to be placed in localopts.h
Z   */
Z  
Z- #define LINEHZ	60
Z  #define EXTERNALITIMES 1
Z--- 3,9 ----
Z   *
Z   * It contains a list the kernel options not prepended to the Makefile
Z   * as -Dxxxx commands to the compiler.  MAXMEM was moved to param.h leaving
Z!  * only EXTERNALITIMES to be placed in localopts.h
Z   */
Z  
Z  #define EXTERNALITIMES 1
Z*** /usr/src/sys/h/kernel.h.old	Fri Mar 12 18:47:41 1993
Z--- /usr/src/sys/h/kernel.h	Fri Feb 14 23:15:48 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kernel.h	1.2 (2.11BSD GTE) 12/24/92
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kernel.h	1.3 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 21,31 ****
Z--- 21,34 ----
Z  int	hostnamelen;
Z  
Z  /* 1.2 */
Z+ #include <sys/time.h>
Z+ 
Z  struct	timeval boottime;
Z  struct	timeval time;
Z  struct	timezone tz;			/* XXX */
Z  int	adjdelta;
Z  int	hz;
Z+ int	mshz;				/* # milliseconds per hz */
Z  int	lbolt;				/* awoken once a second */
Z  int	realitexpire();
Z  
Z*** /usr/src/sys/h/acct.h.old	Sat Feb 22 14:03:47 1992
Z--- /usr/src/sys/h/acct.h	Fri Feb 14 22:04:56 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)acct.h	(2.11BSD) 2/21/92
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)acct.h	2.0	(2.11BSD) 1997/2/14
Z   */
Z  
Z  /*
Z***************
Z*** 39,42 ****
Z   * 1/AHZ is the granularity of the data encoded in the various
Z   * comp_t fields.  This is not necessarily equal to hz.
Z   */
Z! #define AHZ LINEHZ
Z--- 39,42 ----
Z   * 1/AHZ is the granularity of the data encoded in the various
Z   * comp_t fields.  This is not necessarily equal to hz.
Z   */
Z! #define AHZ 64
Z*** /usr/src/sys/h/resource.h.old	Fri Jan 20 19:48:10 1995
Z--- /usr/src/sys/h/resource.h	Fri Feb 14 22:06:01 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)resource.h	1.2 (2.11BSD GTE) 1/14/95
Z   */
Z  
Z  #ifndef	_SYS_RESOURCE_H_
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)resource.h	1.3 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #ifndef	_SYS_RESOURCE_H_
Z***************
Z*** 50,57 ****
Z  
Z  struct	k_rusage {			/* KERNEL RUSAGE STRUCTURE */
Z  #define	k_ru_first	ru_utime
Z! 	long	ru_utime;		/* user time used (LINEHZ ticks) */
Z! 	long	ru_stime;		/* system time used (LINEHZ ticks) */
Z  	long	ru_ovly;		/* overlay changes */
Z  	long	ru_nswap;		/* swaps */
Z  	long	ru_inblock;		/* block input operations */
Z--- 50,57 ----
Z  
Z  struct	k_rusage {			/* KERNEL RUSAGE STRUCTURE */
Z  #define	k_ru_first	ru_utime
Z! 	long	ru_utime;		/* user time used ('hz' ticks) */
Z! 	long	ru_stime;		/* system time used ('hz' ticks) */
Z  	long	ru_ovly;		/* overlay changes */
Z  	long	ru_nswap;		/* swaps */
Z  	long	ru_inblock;		/* block input operations */
Z*** /usr/src/sys/pdp/net_mac.h.old	Sun Jan  3 00:56:21 1993
Z--- /usr/src/sys/pdp/net_mac.h	Fri Feb 14 21:33:00 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	%W% (Berkeley) %G%
Z   */
Z  
Z  struct socket *asoqremque();
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	net_mac.h 2.0 (2.11BSD) 1997/2/14
Z   */
Z  
Z  struct socket *asoqremque();
Z***************
Z*** 66,71 ****
Z--- 66,75 ----
Z  int netpsignal();
Z  #define	NETPSIGNAL(p, sig) \
Z  	SKcall(netpsignal, sizeof(struct proc *) + sizeof(int), p, sig)
Z+ 
Z+ void netsethz();
Z+ #define	NETSETHZ() \
Z+ 	KScall(netsethz, sizeof (hz), hz)
Z  
Z  int netstart();
Z  #define	NETSTART() \
Z*** /usr/src/sys/GENERIC/param.c.old	Mon Jun 17 20:03:40 1996
Z--- /usr/src/sys/GENERIC/param.c	Fri Feb 14 21:35:37 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)param.c	2.1 (2.11BSD GTE) 1/18/95
Z   */
Z  
Z  #include "../h/param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)param.c	2.2 (2.11BSD GTE) 1997/2/14
Z   */
Z  
Z  #include "../h/param.h"
Z***************
Z*** 35,42 ****
Z  #define	MAXUSERS 4
Z  #define	NBUF 32
Z  
Z! int	hz = LINEHZ;
Z  struct	timezone tz = { 480, 1 };
Z  #define	NPROC (10 + 7 * MAXUSERS)
Z  int	nproc = NPROC;
Z  #define NTEXT (26 + MAXUSERS)
Z--- 35,44 ----
Z  #define	MAXUSERS 4
Z  #define	NBUF 32
Z  
Z! int	hz = 60;
Z! u_short	mshz = (1000000L + 60 - 1) / 60;
Z  struct	timezone tz = { 480, 1 };
Z+ 
Z  #define	NPROC (10 + 7 * MAXUSERS)
Z  int	nproc = NPROC;
Z  #define NTEXT (26 + MAXUSERS)
Z*** /usr/src/sys/GENERIC/localopts.h.old	Mon Jun 17 20:04:04 1996
Z--- /usr/src/sys/GENERIC/localopts.h	Fri Feb 14 21:18:08 1997
Z***************
Z*** 3,10 ****
Z   *
Z   * It contains a list the kernel options not prepended to the Makefile
Z   * as -Dxxxx commands to the compiler.  MAXMEM was moved to param.h leaving
Z!  * only LINEHZ and EXTERNALITIMES to be placed in localopts.h
Z   */
Z  
Z- #define LINEHZ	60
Z  #define EXTERNALITIMES 1
Z--- 3,9 ----
Z   *
Z   * It contains a list the kernel options not prepended to the Makefile
Z   * as -Dxxxx commands to the compiler.  MAXMEM was moved to param.h leaving
Z!  * only EXTERNALITIMES to be placed in localopts.h
Z   */
Z  
Z  #define EXTERNALITIMES 1
Z*** /usr/src/sbin/reboot/reboot.c.old	Thu May  9 21:22:50 1996
Z--- /usr/src/sbin/reboot/reboot.c	Sun Feb 16 15:42:52 1997
Z***************
Z*** 9,15 ****
Z  "@(#) Copyright (c) 1980,1986 Regents of the University of California.\n\
Z   All rights reserved.\n";
Z  
Z! static char sccsid[] = "@(#)reboot.c	5.5.2 (2.11BSD) 1996/5/9";
Z  #endif
Z  
Z  /*
Z--- 9,15 ----
Z  "@(#) Copyright (c) 1980,1986 Regents of the University of California.\n\
Z   All rights reserved.\n";
Z  
Z! static char sccsid[] = "@(#)reboot.c	5.5.3 (2.11BSD) 1997/2/16";
Z  #endif
Z  
Z  /*
Z***************
Z*** 100,105 ****
Z--- 100,111 ----
Z  		syslog(LOG_CRIT, "%s; %s by %s",
Z   			args, (howto&RB_HALT)?"halted":"rebooted", user);
Z  	}
Z+ /*
Z+  * Do a sync early on so disks start transfers while we're killing 
Z+  * processes.
Z+ */
Z+ 	if (!(howto & RB_NOSYNC))
Z+ 		sync();
Z  
Z  	(void) signal(SIGHUP, SIG_IGN);	/* for remote connections */
Z  	if (kill(1, SIGTSTP) == -1) {
Z***************
Z*** 108,123 ****
Z  	}
Z  	sleep(1);
Z  	(void) kill(-1, SIGTERM);	/* one chance to catch it */
Z- 	sleep(5);
Z  
Z  	if (!quickly)
Z  		for (i = 1; ; i++) {
Z  			if (kill(-1, SIGKILL) == -1) {
Z- 				extern int errno;
Z- 
Z  				if (errno == ESRCH)
Z  					break;
Z- 
Z  				perror(myname);
Z  				kill(1, SIGHUP);
Z  				exit(EX_OSERR);
Z--- 114,135 ----
Z  	}
Z  	sleep(1);
Z  	(void) kill(-1, SIGTERM);	/* one chance to catch it */
Z  
Z+ /*
Z+  * After the processes receive the TERM signal start the rest of the
Z+  * buffers out to disk.  Wait five seconds between SIGTERM and SIGKILL so
Z+  * the processes have a chance to clean up and exit nicely.
Z+ */
Z+ 	sleep(2);
Z+ 	if (!(howto & RB_NOSYNC))
Z+ 		sync();
Z+ 	sleep(3);
Z+ 
Z  	if (!quickly)
Z  		for (i = 1; ; i++) {
Z  			if (kill(-1, SIGKILL) == -1) {
Z  				if (errno == ESRCH)
Z  					break;
Z  				perror(myname);
Z  				kill(1, SIGHUP);
Z  				exit(EX_OSERR);
Z***************
Z*** 124,130 ****
Z  			}
Z  			if (i > 5) {
Z  				fprintf(stderr,
Z! 				    "CAUTION: some process(es) wouldn\'t die\n");
Z  				break;
Z  			}
Z  			sleep(2 * i);
Z--- 136,142 ----
Z  			}
Z  			if (i > 5) {
Z  				fprintf(stderr,
Z! 				    "CAUTION: some process(es) wouldn't die\n");
Z  				break;
Z  			}
Z  			sleep(2 * i);
Z*** /usr/src/ucb/lastcomm.c.old	Fri Feb  3 22:59:11 1995
Z--- /usr/src/ucb/lastcomm.c	Fri Feb 14 22:11:31 1997
Z***************
Z*** 9,15 ****
Z  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
Z   All rights reserved.\n";
Z  
Z! static char sccsid[] = "@(#)lastcomm.c	5.2.2 (2.11BSD GTE) 2/3/95";
Z  #endif
Z  
Z  /*
Z--- 9,15 ----
Z  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
Z   All rights reserved.\n";
Z  
Z! static char sccsid[] = "@(#)lastcomm.c	5.2.3 (2.11BSD GTE) 1997/2/14";
Z  #endif
Z  
Z  /*
Z***************
Z*** 25,30 ****
Z--- 25,31 ----
Z  #include <utmp.h>
Z  #include <struct.h>
Z  #include <ctype.h>
Z+ #include <stdlib.h>
Z  
Z  struct	acct buf[DEV_BSIZE / sizeof (struct acct)];
Z  
Z***************
Z*** 32,40 ****
Z  char	*flagbits();
Z  char	*getname();
Z  char	*getdev();
Z- 
Z- extern	char	*devname(), *optarg;
Z- extern	int	optind;
Z  
Z  main(argc, argv)
Z  	char *argv[];
Z--- 33,38 ----
Z*** /usr/src/usr.bin/prof/prof.c.old	Fri Jan 21 23:27:32 1994
Z--- /usr/src/usr.bin/prof/prof.c	Fri Feb 14 22:16:25 1997
Z***************
Z*** 1,5 ****
Z  #if	defined(DOSCCS) && !defined(lint)
Z! static	char *sccsid = "@(#)prof.c	4.4.1 (2.11BSD GTE) 1/1/94";
Z  #endif
Z  /*
Z   * prof
Z--- 1,5 ----
Z  #if	defined(DOSCCS) && !defined(lint)
Z! static	char *sccsid = "@(#)prof.c	4.4.2 (2.11BSD GTE) 1997/2/14";
Z  #endif
Z  /*
Z   * prof
Z***************
Z*** 9,17 ****
Z  #include <sys/stat.h>
Z  #include <a.out.h>
Z  #include <sys/time.h>
Z- #ifdef pdp11
Z- #include <sys/localopts.h>	/* For LINEHZ */
Z- #endif
Z  
Z  typedef	short UNIT;		/* unit of profiling */
Z  #ifdef pdp11
Z--- 9,14 ----
Z***************
Z*** 494,499 ****
Z--- 491,497 ----
Z  	fclose(sfile);
Z  }
Z  
Z+ #include <sys/sysctl.h>
Z  /*
Z   *	discover the tick frequency of the machine
Z   *	if something goes wrong, we return 1.
Z***************
Z*** 500,520 ****
Z   */
Z  hertz()
Z  {
Z! #ifdef pdp11
Z! 	return(LINEHZ);
Z! #else
Z! 	struct itimerval tim;
Z  
Z! 	tim.it_interval.tv_sec = 0;
Z! 	tim.it_interval.tv_usec = 1;
Z! 	tim.it_value.tv_sec = 0;
Z! 	tim.it_value.tv_usec = 0;
Z! 	setitimer(ITIMER_REAL, &tim, 0);
Z! 	setitimer(ITIMER_REAL, 0, &tim);
Z! 	if (tim.it_interval.tv_usec < 1)
Z! 		return (1);
Z! 	return (1000000 / tim.it_interval.tv_usec);
Z! #endif
Z  }
Z  
Z  min(a, b)
Z--- 498,512 ----
Z   */
Z  hertz()
Z  {
Z! 	int size, mib[2];
Z! 	struct clockinfo cinfo;
Z  
Z! 	mib[0] = CTL_KERN;
Z! 	mib[1] = KERN_CLOCKRATE;
Z! 	size = sizeof (struct clockinfo);
Z! 	if	(sysctl(mib, 2, &cinfo, &size, NULL, 0) < 0)
Z! 		return(1);
Z! 	return(cinfo.hz);
Z  }
Z  
Z  min(a, b)
Z*** /usr/src/usr.sbin/sa/sa.c.old	Mon Jan 10 21:51:43 1994
Z--- /usr/src/usr.sbin/sa/sa.c	Sat Feb 15 20:34:48 1997
Z***************
Z*** 1,5 ****
Z  #if	defined(DOSCCS) && !defined(lint)
Z! static char *sccsid = "@(#)sa.c	4.9.1 (2.11BSD GTE) 1/1/94";
Z  #endif
Z  
Z  /*
Z--- 1,5 ----
Z  #if	defined(DOSCCS) && !defined(lint)
Z! static char *sccsid = "@(#)sa.c	4.9.2 (2.11BSD GTE) 1997/2/14";
Z  #endif
Z  
Z  /*
Z***************
Z*** 6,15 ****
Z   *	Extensive modifications to internal data structures
Z   *	to allow arbitrary number of different commands and users added.
Z   *	
Z-  *	Also allowed the digit option on the -v flag (interactive
Z-  *	threshold compress) to be a digit string, so one can
Z-  *	set the threshold > 9.
Z-  *
Z   *	Also added the -f flag, to force no interactive threshold
Z   *	compression with the -v flag.
Z   *
Z--- 6,11 ----
Z***************
Z*** 17,25 ****
Z   *	UC Berkeley
Z   *	31jan81
Z   */
Z- #ifdef pdp11
Z- #include <sys/param.h>		/* need LINEHZ for acct.h */
Z- #endif
Z  
Z  #include <stdio.h>
Z  #include <ctype.h>
Z--- 13,18 ----
Z***************
Z*** 28,33 ****
Z--- 21,28 ----
Z  #include <signal.h>
Z  #include <utmp.h>
Z  #include <pwd.h>
Z+ #include <sysexits.h>
Z+ #include <stdlib.h>
Z  
Z  /* interpret command time accounting */
Z  
Z***************
Z*** 231,237 ****
Z  double	tio;
Z  double	timem;
Z  cell	*junkp;
Z- char	*sname;
Z  double	ncom;
Z  time_t	expand();
Z  
Z--- 226,231 ----
Z***************
Z*** 258,264 ****
Z  #define	SAVACCT	"/usr/adm/savacct"
Z  #define	ACCT	"/usr/adm/acct"
Z  #endif	DEBUG
Z- 
Z  
Z  char *usracct = USRACCT;
Z  char *savacct = SAVACCT;
Z--- 252,257 ----
Z***************
Z*** 265,277 ****
Z  
Z  int	cellcmp();
Z  cell	*junkp = 0;
Z- /*
Z-  *	The threshold is built up from digits in the argv ;
Z-  *	eg, -v1s0u1
Z-  *	will build a value of thres of 101.
Z-  *
Z-  *	If the threshold is zero after processing argv, it is set to 1
Z-  */
Z  int	thres = 0;	
Z  int	htabinstall = 1;
Z  int	(*cmp)();
Z--- 258,263 ----
Z***************
Z*** 290,296 ****
Z  	double ft;
Z  	register struct	allocbox *allocwalk;
Z  	register cell *tp, *ub;
Z! 	int i, j, size, nchunks, smallest;
Z  	struct chunkdesc *chunkvector;
Z  
Z  	pgdiv = getpagesize() / 1024;
Z--- 276,283 ----
Z  	double ft;
Z  	register struct	allocbox *allocwalk;
Z  	register cell *tp, *ub;
Z! 	char	*acctfn;
Z! 	int i, j, size, nchunks, smallest, c;
Z  	struct chunkdesc *chunkvector;
Z  
Z  	pgdiv = getpagesize() / 1024;
Z***************
Z*** 300,455 ****
Z  
Z  	tabinit();
Z  	cmp = tcmp;
Z- 	if (argc>1)
Z- 	if (argv[1][0]=='-') {
Z- 		argv++;
Z- 		argc--;
Z- 		for(i=1; argv[0][i]; i++)
Z- 		switch(argv[0][i]) {
Z  
Z! 		case 'o':
Z! 			oflg++;
Z! 			break;
Z! 
Z! 		case 'i':
Z! 			iflg++;
Z! 			break;
Z! 
Z! 		case 'b':
Z! 			bflg++;
Z! 			cmp = Bcmp;
Z! 			break;
Z! 
Z! 		case 'l':
Z! 			lflg++;
Z! 			break;
Z! 
Z! 		case 'c':
Z! 			cflg++;
Z! 			break;
Z! 
Z! 		case 'd':
Z! 			dflg++;
Z! 			cmp = dcmp;
Z! 			break;
Z! 
Z! 		case 'D':
Z! 			Dflg++;
Z! 			cmp = Dcmp;
Z! 			break;
Z! 
Z! 		case 'j':
Z! 			jflg++;
Z! 			break;
Z! 
Z! 		case 'k':
Z! 			kflg++;
Z! 			cmp = kcmp;
Z! 			break;
Z! 
Z! 		case 'K':
Z! 			Kflg++;
Z! 			cmp = Kcmp;
Z! 			break;
Z! 
Z! 		case 'n':
Z! 			nflg++;
Z! 			cmp = ncmp;
Z! 			break;
Z! 
Z! 		case 'a':
Z! 			aflg++;
Z! 			break;
Z! 
Z! 		case 'r':
Z! 			rflg++;
Z! 			break;
Z! 
Z! 		case 't':
Z! 			tflg++;
Z! 			break;
Z! 
Z! 		case 's':
Z! 			sflg++;
Z! 			aflg++;
Z! 			break;
Z! 
Z! 		case '0':
Z! 		case '1':
Z! 		case '2':
Z! 		case '3':
Z! 		case '4':
Z! 		case '5':
Z! 		case '6':
Z! 		case '7':
Z! 		case '8':
Z! 		case '9':
Z! 			thres = thres * 10 + (argv[0][i]-'0');
Z! 			break;
Z! 
Z! 		case 'v':
Z! 			vflg++;
Z! 			break;
Z! 
Z! 		case 'f':
Z! 			fflg++;	/* force v option; no tty interaction */
Z! 			break;
Z! 
Z! 		case 'u':
Z! 			uflg++;
Z! 			break;
Z! 
Z! 		case 'm':
Z! 			mflg++;
Z! 			break;
Z! 
Z! 		case 'U':
Z! 		case 'S':
Z! 			if (i != 1 || argv[0][2]) {	/* gross! */
Z! 				fprintf(stderr, "-U and -S options must be separate\n");
Z! 				exit(1);
Z  			}
Z- 			argc++, argv--;			/* backup - yuk */
Z- 			goto doUS;
Z- 
Z- 		default:
Z- 		    	fprintf(stderr, "Invalid option %c\n", argv[0][1]);
Z- 			exit(1);
Z  		}
Z! 	}
Z! 
Z! #define optfile(f) {if (argc < 2) \
Z! 			{ fprintf(stderr, "Missing filename\n"); exit(1); } \
Z! 			argc--, argv++; f = argv[0]; }
Z! 
Z! doUS:
Z! 	for (argc--, argv++; argc && argv[0][0] == '-'; argc--, argv++) {
Z! 		switch(argv[0][1]) {
Z! 		    case 'U':
Z! 		    	optfile(usracct);
Z  			break;
Z! 
Z! 		    case 'S':
Z! 		    	optfile(savacct);
Z  			break;
Z! 
Z! 		    default:
Z! 		    	fprintf(stderr, "Invalid option %c\n", argv[0][1]);
Z! 			exit(1);
Z  		}
Z- 	}
Z  
Z! 	if (thres == 0)
Z  		thres = 1;
Z! 	if (iflg==0)
Z  		init();
Z! 	if (argc<1)
Z! 		doacct(ACCT);
Z! 	else while (argc--)
Z! 		doacct(*argv++);
Z! 	if (uflg) {
Z  		return;
Z- 	}
Z  
Z  /*
Z   * cleanup pass
Z--- 287,393 ----
Z  
Z  	tabinit();
Z  	cmp = tcmp;
Z  
Z! 	while	((c = getopt(argc, argv, "oiblcdDjkKnartsv:fumU:S:")) != EOF)
Z! 		{
Z! 		switch	(c)
Z! 			{
Z! 			case	'o':
Z! 				oflg++;
Z! 				break;
Z! 			case	'i':
Z! 				iflg++;
Z! 				break;
Z! 			case	'b':
Z! 				bflg++;
Z! 				cmp = Bcmp;
Z! 				break;
Z! 			case	'l':
Z! 				lflg++;
Z! 				break;
Z! 			case	'c':
Z! 				cflg++;
Z! 				break;
Z! 			case	'd':
Z! 				dflg++;
Z! 				cmp = dcmp;
Z! 				break;
Z! 			case	'D':
Z! 				Dflg++;
Z! 				cmp = Dcmp;
Z! 				break;
Z! 			case	'j':
Z! 				jflg++;
Z! 				break;
Z! 			case	'k':
Z! 				kflg++;
Z! 				cmp = kcmp;
Z! 				break;
Z! 			case	'K':
Z! 				Kflg++;
Z! 				cmp = Kcmp;
Z! 				break;
Z! 			case	'n':
Z! 				nflg++;
Z! 				cmp = ncmp;
Z! 				break;
Z! 			case	'a':
Z! 				aflg++;
Z! 				break;
Z! 			case	'r':
Z! 				rflg++;
Z! 				break;
Z! 			case	't':
Z! 				tflg++;
Z! 				break;
Z! 			case	's':
Z! 				sflg++;
Z! 				aflg++;
Z! 				break;
Z! 			case	'v':
Z! 				vflg++;
Z! 				thres = atoi(optarg);
Z! 				break;
Z! 			case	'f':
Z! 				fflg++;	/* force v option; no tty interaction */
Z! 				break;
Z! 			case	'u':
Z! 				uflg++;
Z! 				break;
Z! 			case	'm':
Z! 				mflg++;
Z! 				break;
Z! 			case	'U':
Z! 				usracct = optarg;
Z! 				break;
Z! 			case	'S':
Z! 				savacct = optarg;
Z! 				break;
Z! 			default:
Z! 				(void)usage();
Z! 				/* NOTREACHED */
Z  			}
Z  		}
Z! 	switch	(argc - optind)
Z! 		{
Z! 		case	1:
Z! 			acctfn = argv[optind];
Z  			break;
Z! 		case	0:
Z! 			acctfn = ACCT;
Z  			break;
Z! 		default:
Z! 			(void)usage();
Z! 			/* NOTREACHED */
Z  		}
Z  
Z! 	if	(thres == 0)
Z  		thres = 1;
Z! 	if	(iflg==0)
Z  		init();
Z! 	doacct(acctfn);
Z! 	if	(uflg)
Z  		return;
Z  
Z  /*
Z   * cleanup pass
Z***************
Z*** 500,511 ****
Z  		}
Z  		if ((ff = fopen(savacct, "w")) == NULL) {
Z  			printf("Can't save\n");
Z! 			exit(0);
Z  		}
Z  		PROCESSITERATE(allocwalk, tp, ub)
Z  			fwrite((char *)&(tp->p), sizeof(struct process), 1, ff);
Z  		fclose(ff);
Z- 		creat(sname, 0644);
Z  		signal(SIGINT, SIG_DFL);
Z  	}
Z  /*
Z--- 438,448 ----
Z  		}
Z  		if ((ff = fopen(savacct, "w")) == NULL) {
Z  			printf("Can't save\n");
Z! 			exit(EX_OK);
Z  		}
Z  		PROCESSITERATE(allocwalk, tp, ub)
Z  			fwrite((char *)&(tp->p), sizeof(struct process), 1, ff);
Z  		fclose(ff);
Z  		signal(SIGINT, SIG_DFL);
Z  	}
Z  /*
Z***************
Z*** 513,519 ****
Z   */
Z  	if (mflg) {
Z  		printmoney();
Z! 		exit(0);
Z  	}
Z  	column(ncom, treal, tcpu, tsys, timem, tio);
Z  	printf("\n");
Z--- 450,456 ----
Z   */
Z  	if (mflg) {
Z  		printmoney();
Z! 		exit(EX_OK);
Z  	}
Z  	column(ncom, treal, tcpu, tsys, timem, tio);
Z  	printf("\n");
Z***************
Z*** 564,569 ****
Z--- 501,513 ----
Z  	}	/* iterate to merge the lists */
Z  }
Z  
Z+ void
Z+ usage()
Z+ 	{
Z+ 	fprintf(stderr, "Usage sa [-oiblcdDjkKnartsfum] [-S savacct] [-U usracct] [file]\n");
Z+ 	exit(EX_USAGE);
Z+ 	}
Z+ 
Z  printmoney()
Z  {
Z  	register uid_t uid;
Z***************
Z*** 646,665 ****
Z  	int	nrecords = 0;
Z  #endif DEBUG
Z  
Z- 	if (sflg && sname) {
Z- 		printf("Only 1 file with -s\n");
Z- 		exit(0);
Z- 	}
Z- 	if (sflg)
Z- 		sname = f;
Z  	if ((ff = fopen(f, "r"))==NULL) {
Z! 		printf("Can't open %s\n", f);
Z  		return;
Z  	}
Z  	while (fread((char *)&fbuf, sizeof(fbuf), 1, ff) == 1) {
Z  #ifdef DEBUG
Z  		if (++nrecords % 1000 == 0)
Z! 			printf("Input record from %s number %d\n",
Z  				f, nrecords);
Z  #endif DEBUG
Z  		for (cp = fbuf.ac_comm; *cp && cp < &fbuf.ac_comm[NC]; cp++)
Z--- 590,603 ----
Z  	int	nrecords = 0;
Z  #endif DEBUG
Z  
Z  	if ((ff = fopen(f, "r"))==NULL) {
Z! 		fprintf(stderr, "Can't open %s\n", f);
Z  		return;
Z  	}
Z  	while (fread((char *)&fbuf, sizeof(fbuf), 1, ff) == 1) {
Z  #ifdef DEBUG
Z  		if (++nrecords % 1000 == 0)
Z! 			fprintf(stderr, "Input record from %s number %d\n",
Z  				f, nrecords);
Z  #endif DEBUG
Z  		for (cp = fbuf.ac_comm; *cp && cp < &fbuf.ac_comm[NC]; cp++)
Z***************
Z*** 676,686 ****
Z  			*cp = '\0';
Z  		x = expand(fbuf.ac_utime) + expand(fbuf.ac_stime);
Z  		y = pgtok((u_short)fbuf.ac_mem);
Z- #ifdef pdp11
Z- 		z = expand(fbuf.ac_io);
Z- #else
Z  		z = expand(fbuf.ac_io) / AHZ;
Z- #endif
Z  		if (uflg) {
Z  			printf("%3u %6.2f cpu %8luk mem %6ld io %.*s\n",
Z  			    fbuf.ac_uid, x/(double)AHZ, y, z, NC, fbuf.ac_comm);
Z--- 614,620 ----
Z***************
Z*** 718,724 ****
Z   *	Generalized cell compare routine, to cast out users
Z   */
Z  cellcmp(p1, p2)
Z! 	cell *p1, *p2;
Z  {
Z  	if (ISPROCESS(p1)){
Z  		if (ISPROCESS(p2))
Z--- 652,658 ----
Z   *	Generalized cell compare routine, to cast out users
Z   */
Z  cellcmp(p1, p2)
Z! 	register cell *p1, *p2;
Z  {
Z  	if (ISPROCESS(p1)){
Z  		if (ISPROCESS(p2))
Z***************
Z*** 731,737 ****
Z  }
Z  
Z  ncmp(p1, p2)
Z! 	cell *p1, *p2;
Z  {
Z  
Z  	if(p1->p.count == p2->p.count)
Z--- 665,671 ----
Z  }
Z  
Z  ncmp(p1, p2)
Z! 	register cell *p1, *p2;
Z  {
Z  
Z  	if(p1->p.count == p2->p.count)
Z***************
Z*** 763,769 ****
Z  }
Z  
Z  Kcmp(p1, p2)
Z! 	cell *p1, *p2;
Z  {
Z  
Z  	if (p1->p.imem < p2->p.imem) {
Z--- 697,703 ----
Z  }
Z  
Z  Kcmp(p1, p2)
Z! 	register cell *p1, *p2;
Z  {
Z  
Z  	if (p1->p.imem < p2->p.imem) {
Z***************
Z*** 780,786 ****
Z  }
Z  
Z  kcmp(p1, p2)
Z! 	cell *p1, *p2;
Z  {
Z  	double a1, a2;
Z  
Z--- 714,720 ----
Z  }
Z  
Z  kcmp(p1, p2)
Z! 	register cell *p1, *p2;
Z  {
Z  	double a1, a2;
Z  
Z***************
Z*** 800,806 ****
Z  }
Z  
Z  dcmp(p1, p2)
Z! 	cell *p1, *p2;
Z  {
Z  	double a1, a2;
Z  
Z--- 734,740 ----
Z  }
Z  
Z  dcmp(p1, p2)
Z! 	register cell *p1, *p2;
Z  {
Z  	double a1, a2;
Z  
Z***************
Z*** 820,826 ****
Z  }
Z  
Z  Dcmp(p1, p2)
Z! 	cell *p1, *p2;
Z  {
Z  
Z  	if (p1->p.io < p2->p.io) {
Z--- 754,760 ----
Z  }
Z  
Z  Dcmp(p1, p2)
Z! 	register cell *p1, *p2;
Z  {
Z  
Z  	if (p1->p.io < p2->p.io) {
Z***************
Z*** 941,949 ****
Z  
Z  time_t
Z  expand(t)
Z! 	unsigned t;
Z  {
Z! 	register time_t nt;
Z  
Z  	nt = t&017777;
Z  	t >>= 13;
Z--- 875,883 ----
Z  
Z  time_t
Z  expand(t)
Z! 	register unsigned int t;
Z  {
Z! 	time_t nt;
Z  
Z  	nt = t&017777;
Z  	t >>= 13;
Z***************
Z*** 1000,1006 ****
Z  {
Z  	register struct user *tp;
Z  	register struct passwd *pw;
Z- 	struct passwd *getpwent();
Z  
Z  	setpwent();
Z  	while (pw = getpwent()){
Z--- 934,939 ----
Z***************
Z*** 1016,1022 ****
Z  {
Z  	register struct user *tp;
Z  	register struct passwd *pw;
Z- 	struct passwd *getpwent();
Z  	uid_t maxuid = 0;
Z  
Z  	setpwent();
Z--- 949,954 ----
Z*** /usr/src/usr.sbin/sa/sa.8.old	Sun Nov 17 21:04:17 1996
Z--- /usr/src/usr.sbin/sa/sa.8	Sat Feb 15 20:39:19 1997
Z***************
Z*** 2,8 ****
Z  .\" All rights reserved.  The Berkeley software License Agreement
Z  .\" specifies the terms and conditions for redistribution.
Z  .\"
Z! .\"	@(#)sa.8	6.2.1 (2.11BSD) 1996/11/16
Z  .\"
Z  .TH SA 8 "November 16, 1996"
Z  .UC 4
Z--- 2,8 ----
Z  .\" All rights reserved.  The Berkeley software License Agreement
Z  .\" specifies the terms and conditions for redistribution.
Z  .\"
Z! .\"	@(#)sa.8	6.2.2 (2.11BSD) 1997/2/15
Z  .\"
Z  .TH SA 8 "November 16, 1996"
Z  .UC 4
Z***************
Z*** 11,17 ****
Z  .SH SYNOPSIS
Z  .B sa
Z  [
Z! .B \-abcdDfijkKlnrstuv
Z  ] [
Z  .B \-S
Z  savacctfile ] [
Z--- 11,19 ----
Z  .SH SYNOPSIS
Z  .B sa
Z  [
Z! .B \-abcdDfijkKlnrstu
Z! ] [
Z! \fB\-v\fP \fIthreshold\fP
Z  ] [
Z  .B \-S
Z  savacctfile ] [
Z*** /VERSION.old	Fri Feb  7 21:31:20 1997
Z--- /VERSION	Fri Feb 14 23:05:48 1997
Z***************
Z*** 1,5 ****
Z! Current Patch Level: 365
Z! Date: February 6, 1997
Z  
Z  2.11 BSD
Z  ============
Z--- 1,5 ----
Z! Current Patch Level: 366
Z! Date: February 14, 1997
Z  
Z  2.11 BSD
Z  ============
SHAR_EOF
fi
if test -f '/tmp/366.localopts.patch'
then
	echo shar: "will not over-write existing file '/tmp/366.localopts.patch'"
else
sed 's/^Z//' << \SHAR_EOF > '/tmp/366.localopts.patch'
Z6c6
Z<  * only LINEHZ and EXTERNALITIMES to be placed in localopts.h
Z---
Z>  * only EXTERNALITIMES to be placed in localopts.h
Z9d8
Z< #define LINEHZ	60
SHAR_EOF
fi
if test -f '/tmp/366.param.c.patch'
then
	echo shar: "will not over-write existing file '/tmp/366.param.c.patch'"
else
sed 's/^Z//' << \SHAR_EOF > '/tmp/366.param.c.patch'
Z6c6
Z<  *	@(#)param.c	2.1 (2.11BSD GTE) 1/18/95
Z---
Z>  *	@(#)param.c	2.2 (2.11BSD GTE) 1997/2/14
Z38c38,39
Z< int	hz = LINEHZ;
Z---
Z> int	hz = 60;
Z> u_short	mshz = (1000000L + 60 - 1) / 60;
Z39a41
Z> 
SHAR_EOF
fi
exit 0
#	End of shell archive