Subject: securelevel support incomplete, 'sysctl' missing (#222 - part 4 of 5) Index: sys,bin,lib,usr.lib,usr.bin/many 2.11BSD Description: The support for 'securelevel' is incomplete, part of it was added back in updates #197 thru 210 (when the 'chflags' syscall was implemented). But without a means of setting the security level of the system the level was fixed at -1. There is no 'sysctl' system call present. In addition to retrieving and setting the security level of the system the sysctl() call can be used to read many other kernel data structures without having to perform a nlist(3) on the kernel image. Also, there are present in the C library several obsolete (they were obsolete even when 2.11BSD was new) routines. Repeat-By: Observation. You may wish to refer to update #197 in which mention is made of the 'securelevel' feature. The manpages for sysctl(3) and sysctl(8) are in the shar file below. Fix: sysctl() was borrowed from 4.4BSD-Lite. Everything except the 'networking' portion has been ported - that will be done in the future. Initially only enough of sysctl() was going to be ported to manipulate the 'securelevel' of the system. As the porting effort got underway it became apparent that with not much extra effort the whole sysctl() call could be implemented. As a demonstration of how much faster sysctl() is than 'nlist()' a couple of the programs in the system have been converted to use sysctl() instead of nlist()+read() to fetch information from the kernel. You may wish to save the 'w' and 'welcome' programs in order to compare the runtimes before and after being converted. As time goes on additional utilities will be switched over from nlist() to sysctl(). This is part 4 of 5 (updates 219 thru 223). The contents of each part are as follow: Part/Update# Contents ============ ======== 1 / 219 shar file of new files added to the system 2 / 220 shell script to remove obsolete files 3 / 221 patch file 1 4 / 222 patch file 2 5 / 223 patch file 3 The following files are modified by this part: /usr/src/bin/adb/opset.c /usr/src/bin/ld/Makefile /usr/src/bin/Makefile /usr/src/etc/init.c /usr/src/etc/rwhod.c /usr/src/etc/Makefile /usr/src/etc/bad144.c /usr/lib/lint/llib-lc /usr/src/lib/libc/gen/Makefile /usr/src/lib/libc/pdp/sys/Makefile /usr/src/lib/libc/pdp/compat-2.9/Makefile /usr/src/lib/libc/compat-4.1/Makefile /usr/src/usr.lib/sendmail/src/conf.c /usr/src/man/man2/Makefile /usr/src/man/man3/Makefile /usr/src/new/jove/util.c /usr/src/new/la/la.c /usr/src/ucb/w.c Most of the Makefile changes are related to adding or removing routines from libc.a. The change to ld/Makefile is to increase the in-core symbol table size slightly. After monitoring the diagnostic output from 'ld' for a year it was found to be safe to add another 2kb to the symbol table. This will reduce the amount of 'paging' that ld must do when linking complex executables. 'init' now changes the "securelevel" of the system to 0 when the system enters the single user state. When the system goes to multiuser the securelevel is set to 1 unless 1) sysctl(8) is used in /etc/rc to set securelevel to 2 or 2) param.c in the kernel has been edited to force securelevel to -1. The 'w' program was rewritten to use sysctl(3) to retrieve information from the kernel rather than nlist()+read(). la, jove and sendmail have been modified to call 'getloadavg(3)' rather than 'loadav(3)'. 'rwhod' was rewritten to use sysctl(3). This should cure once and for all the problem of rwhod crashing because its /dev/kmem file descriptor mysteriously gets closed. Other changes were made to rwhod that result in it using much less cpu time than before. Instructions: 1) Cut where indicated and save to a file (/tmp/foo) 2) patch -p0 < /tmp/foo DO NOT compile anything yet. There will be a detailed, step-by-step checklist of what to compile in the last part of this kit (#223). =================cut here==================== *** /usr/src/bin/adb/opset.c.old Mon Dec 26 17:38:17 1994 --- /usr/src/bin/adb/opset.c Mon Jan 16 19:41:09 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)opset.c 2.0 (2.11BSD GTE) 12/26/94"; #endif #include "defs.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)opset.c 2.1 (2.11BSD GTE) 1/16/95"; #endif #include "defs.h" *************** *** 155,161 **** "getpid", "mount", "umount", ! NULL, /* 23 - old setuid */ "getuid", NULL, /* 25 - old stime */ "ptrace", --- 155,161 ---- "getpid", "mount", "umount", ! "__sysctl", "getuid", NULL, /* 25 - old stime */ "ptrace", *** /usr/src/bin/ld/Makefile.old Sat Jan 22 16:42:34 1994 --- /usr/src/bin/ld/Makefile Thu Jan 19 21:55:45 1995 *************** *** 1,6 **** SRCS= ld.c OBJS= ld.o ! CFLAGS= -O -I../ar -DNUM_VM_PAGES=18 all: ld --- 1,8 ---- + # Version 2.1 January 19, 1994 + SRCS= ld.c OBJS= ld.o ! CFLAGS= -O -I../ar -DNUM_VM_PAGES=20 all: ld *** /usr/src/bin/Makefile.old Sat Dec 3 20:54:58 1994 --- /usr/src/bin/Makefile Sun Jan 15 22:42:00 1995 *************** *** 3,9 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.19.3 (2.11BSD GTE) 12/3/94 # DESTDIR= CFLAGS= -O --- 3,9 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.19.4 (2.11BSD GTE) 1/15/95 # DESTDIR= CFLAGS= -O *************** *** 12,18 **** # Programs that live in subdirectories, and have makefiles of their own. # SUBDIR= adb ar as awk chflags chpass csh diff ld login ls make nm passwd \ ! sed sh tp # Shell scripts that need only be installed and are never removed. # --- 12,18 ---- # Programs that live in subdirectories, and have makefiles of their own. # SUBDIR= adb ar as awk chflags chpass csh diff ld login ls make nm passwd \ ! sed sh sysctl tp # Shell scripts that need only be installed and are never removed. # *** /usr/src/etc/init.c.old Sat Jan 15 11:21:21 1994 --- /usr/src/etc/init.c Tue Jan 17 21:50:15 1995 *************** *** 5,15 **** */ #if defined(DOSCCS) && !defined(lint) ! static char sccsid[] = "@(#)init.c 5.6.1 (2.11BSD GTE) 1/1/94"; #endif #include - #include #include #include #include --- 5,16 ---- */ #if defined(DOSCCS) && !defined(lint) ! static char sccsid[] = "@(#)init.c 5.6.1 (2.11BSD GTE) 1/17/95"; #endif + #include + #include #include #include #include #include *************** *** 60,65 **** --- 61,69 ---- char *strcpy(), *strcat(); long lseek(); time_t time(); + void setsecuritylevel(); + int getsecuritylevel(); + int badsys(); struct sigvec rvec = { reset, sigmask(SIGHUP), 0 }; *************** *** 104,114 **** --- 108,124 ---- } #endif #endif + if (getuid() != 0) + exit(1); + if (getpid() != 1) + exit(1); + openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH); #ifdef pdp11 if (autoconfig() == 0) howto = RB_SINGLE; #endif + signal(SIGSYS, badsys); sigvec(SIGTERM, &rvec, (struct sigvec *)0); signal(SIGTSTP, idle); signal(SIGSTOP, SIG_IGN); *************** *** 194,199 **** --- 204,280 ---- return (1); } + /* + * Catch a SIGSYS signal. + * + * These may arise if a system does not support sysctl. + * We tolerate up to 25 of these, then throw in the towel. + */ + int + badsys(sig) + int sig; + { + static int badcount = 0; + + if (badcount++ < 25) + return; + syslog(LOG_EMERG, "fatal signal: %d", sig); + sleep(30); + _exit(sig); + } + + /* + * Get the security level of the kernel. + */ + int + getsecuritylevel() + { + #ifdef KERN_SECURELVL + int name[2], curlevel; + size_t len; + extern int errno; + + name[0] = CTL_KERN; + name[1] = KERN_SECURELVL; + len = sizeof curlevel; + if (sysctl(name, 2, &curlevel, &len, NULL, 0) == -1) { + syslog(LOG_EMERG, "cannot get kernel security level: %s", + strerror(errno)); + return (-1); + } + return (curlevel); + #else + return (-1); + #endif + } + + /* + * Set the security level of the kernel. + */ + void + setsecuritylevel(newlevel) + int newlevel; + { + #ifdef KERN_SECURELVL + int name[2], curlevel; + extern int errno; + + curlevel = getsecuritylevel(); + if (newlevel == curlevel) + return; + name[0] = CTL_KERN; + name[1] = KERN_SECURELVL; + if (sysctl(name, 2, NULL, NULL, &newlevel, sizeof newlevel) == -1) { + syslog(LOG_EMERG, + "cannot change kernel security level from %d to %d: %s", + curlevel, newlevel, strerror(errno)); + return; + } + syslog(LOG_ALERT, "kernel security level changed from %d to %d", + curlevel, newlevel); + #endif + } + single() { register pid; *************** *** 200,205 **** --- 281,292 ---- register xpid; extern errno; + /* + * If the kernel is in secure mode, downgrade it to insecure mode. + */ + if (getsecuritylevel() > 0) + setsecuritylevel(0); + do { pid = fork(); if (pid == 0) { *************** *** 284,289 **** --- 371,385 ---- register struct tab *p; register pid; long omask; + + /* + * If the administrator has not set the security level to -1 + * to indicate that the kernel should not run multiuser in secure + * mode, and the run script has not set a higher level of security + * than level 1, then put the kernel into secure mode. + */ + if (getsecuritylevel() == 0) + setsecuritylevel(1); sigvec(SIGHUP, &mvec, (struct sigvec *)0); for (EVER) { *** /usr/src/etc/rwhod.c.old Tue Sep 4 08:35:12 1990 --- /usr/src/etc/rwhod.c Fri Jan 20 23:44:02 1995 *************** *** 4,29 **** * specifies the terms and conditions for redistribution. */ ! #ifndef lint char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; - #endif not lint ! #ifndef lint ! static char sccsid[] = "@(#)rwhod.c 5.9 (Berkeley) 3/5/86"; #endif not lint #include #include #include #include #include #include #include - #include #include #include #include --- 4,28 ---- * specifies the terms and conditions for redistribution. */ ! #if !defined(lint) && defined(DOSCCS) char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)rwhod.c 5.9.1 (2.11BSD) 1/16/95"; #endif not lint + #include #include #include #include #include + #include #include #include #include #include #include #include *************** *** 44,59 **** extern errno; time_t time(); ! char myname[32]; - struct nlist nl[] = { - #define NL_AVENRUN 0 - { "_avenrun" }, - #define NL_BOOTTIME 1 - { "_boottime" }, - 0 - }; - /* * We communicate with each neighbor in * a list constructed at the time we're --- 43,50 ---- extern errno; time_t time(); ! char myname[MAXHOSTNAMELEN]; /* * We communicate with each neighbor in * a list constructed at the time we're *************** *** 71,85 **** struct neighbor *neighbors; struct whod mywd; struct servent *sp; ! int s, utmpf, kmemf = -1; #define WHDRSIZE (sizeof (mywd) - sizeof (mywd.wd_we)) #define RWHODIR "/usr/spool/rwho" ! int onalrm(); char *strcpy(), *sprintf(), *malloc(); long lseek(); - int getkmem(); main() { --- 62,75 ---- struct neighbor *neighbors; struct whod mywd; struct servent *sp; ! int s, utmpf; #define WHDRSIZE (sizeof (mywd) - sizeof (mywd.wd_we)) #define RWHODIR "/usr/spool/rwho" ! int onalrm(), getboottime(); char *strcpy(), *sprintf(), *malloc(); long lseek(); main() { *************** *** 119,125 **** perror(RWHODIR); exit(1); } ! (void) signal(SIGHUP, getkmem); openlog("rwhod", LOG_PID, LOG_DAEMON); /* * Establish host name as returned by system. --- 109,115 ---- perror(RWHODIR); exit(1); } ! (void) signal(SIGHUP, getboottime); openlog("rwhod", LOG_PID, LOG_DAEMON); /* * Establish host name as returned by system. *************** *** 140,146 **** syslog(LOG_ERR, "/etc/utmp: %m"); exit(1); } ! getkmem(); if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, "socket: %m"); exit(1); --- 130,136 ---- syslog(LOG_ERR, "/etc/utmp: %m"); exit(1); } ! getboottime(0); if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, "socket: %m"); exit(1); *************** *** 164,170 **** cc = recvfrom(s, (char *)&wd, sizeof (struct whod), 0, &from, &len); - if (kmemf != 4 || s != 5 || utmpf != 3) abort("kmemf != 4"); if (cc <= 0) { if (cc < 0 && errno != EINTR) syslog(LOG_WARNING, "recv: %m"); --- 154,159 ---- *************** *** 175,187 **** ntohs(from.sin_port)); continue; } - if (gethostbyname(wd.wd_hostname) == 0) { - #ifdef notdef - syslog(LOG_WARNING, "%s: unknown host", - wd.wd_hostname); - #endif - continue; - } if (wd.wd_vers != WHODVERSION) continue; if (wd.wd_type != WHODTYPE_STATUS) --- 164,169 ---- *************** *** 261,272 **** struct stat stb; register struct whoent *we = mywd.wd_we, *wlast; int cc; ! short avenrun[3]; time_t now = time(0); register struct neighbor *np; if (alarmcount % 10 == 0) ! getkmem(); alarmcount++; (void) fstat(utmpf, &stb); if ((stb.st_mtime != utmptime) || (stb.st_size > utmpsize)) { --- 243,254 ---- struct stat stb; register struct whoent *we = mywd.wd_we, *wlast; int cc; ! double avenrun[3]; time_t now = time(0); register struct neighbor *np; if (alarmcount % 10 == 0) ! getboottime(0); alarmcount++; (void) fstat(utmpf, &stb); if ((stb.st_mtime != utmptime) || (stb.st_size > utmpsize)) { *************** *** 320,329 **** we->we_idle = htonl(now - stb.st_atime); we++; } ! (void) lseek(kmemf, (long)nl[NL_AVENRUN].n_value, L_SET); ! (void) read(kmemf, (char *)avenrun, sizeof (avenrun)); for (i = 0; i < 3; i++) ! mywd.wd_loadav[i] = htonl((u_long)(100.0 * avenrun[i]/256.0)); cc = (char *)we - (char *)&mywd; mywd.wd_sendtime = htonl(time(0)); mywd.wd_vers = WHODVERSION; --- 302,310 ---- we->we_idle = htonl(now - stb.st_atime); we++; } ! (void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0])); for (i = 0; i < 3; i++) ! mywd.wd_loadav[i] = htonl((u_long)(100.0 * avenrun[i])); cc = (char *)we - (char *)&mywd; mywd.wd_sendtime = htonl(time(0)); mywd.wd_vers = WHODVERSION; *************** *** 339,376 **** (void) alarm(AL_INTERVAL); } ! getkmem() { ! static ino_t vmunixino; ! static time_t vmunixctime; ! struct stat sb; ! if (stat("/unix", &sb) < 0) { ! if (vmunixctime) ! return; ! } else { ! if (sb.st_ctime == vmunixctime && sb.st_ino == vmunixino) ! return; ! vmunixctime = sb.st_ctime; ! vmunixino= sb.st_ino; ! } ! if (kmemf >= 0) ! (void) close(kmemf); ! loop: ! if (nlist("/unix", nl)) { ! syslog(LOG_WARNING, "/unix namelist botch"); ! sleep(300); ! goto loop; ! } ! kmemf = open("/dev/kmem", O_RDONLY); ! if (kmemf < 0) { ! syslog(LOG_ERR, "/dev/kmem: %m"); exit(1); } ! (void) lseek(kmemf, (long)nl[NL_BOOTTIME].n_value, L_SET); ! (void) read(kmemf, (char *)&mywd.wd_boottime, ! sizeof (mywd.wd_boottime)); ! mywd.wd_boottime = htonl(mywd.wd_boottime); } /* --- 320,340 ---- (void) alarm(AL_INTERVAL); } ! getboottime(signo) ! int signo; { ! int mib[2]; ! size_t size; ! struct timeval tm; ! mib[0] = CTL_KERN; ! mib[1] = KERN_BOOTTIME; ! size = sizeof (tm); ! if (sysctl(mib, 2, &tm, &size, NULL, 0) == -1) { ! syslog(LOG_ERR, "cannot get boottime: %m"); exit(1); } ! mywd.wd_boottime = htonl(tm.tv_sec); } /* *** /usr/src/etc/Makefile.old Mon Jan 18 08:46:31 1993 --- /usr/src/etc/Makefile Tue Jan 17 23:41:08 1995 *************** *** 3,9 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.14 (Berkeley) 5/16/86 # DESTDIR= CFLAGS= -O --- 3,9 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.14.1 (2.11BSD GTE) 1/17/95 # DESTDIR= CFLAGS= -O *************** *** 77,83 **** -ln ${DESTDIR}/etc/reboot ${DESTDIR}/etc/fastboot -ln ${DESTDIR}/etc/reboot ${DESTDIR}/etc/halt -mkdir ${DESTDIR}/usr/spool/rwho ! -chmod 700 ${DESTDIR}/etc/init clean: -rm -f a.out core *.s *.o --- 77,83 ---- -ln ${DESTDIR}/etc/reboot ${DESTDIR}/etc/fastboot -ln ${DESTDIR}/etc/reboot ${DESTDIR}/etc/halt -mkdir ${DESTDIR}/usr/spool/rwho ! -chmod 755 ${DESTDIR}/etc/init clean: -rm -f a.out core *.s *.o *** /usr/src/etc/bad144.c.old Tue Aug 10 19:50:29 1993 --- /usr/src/etc/bad144.c Sat Jan 21 17:43:41 1995 *************** *** 19,24 **** --- 19,26 ---- * error in the header. * * RP07 entry added August 10, 1993 (thanks to Johnny Billquist) - SMS + * + * lseek() replaced tell() - Jan 21, 1994 - SMS */ #include #ifndef BADSECT *************** *** 54,60 **** struct dkbad bad; char buf[512]; } dkbad; ! long tell(); long atol(); main(argc, argv) --- 56,62 ---- struct dkbad bad; char buf[512]; } dkbad; ! off_t lseek(); long atol(); main(argc, argv) *************** *** 95,101 **** } lseek(f, 512 * (di->di_size - di->di_nsect), 0); printf("bad block information at 0x%X in %s:\n", ! tell(f), name); if (read(f, &dkbad, 512) != 512) { fprintf(stderr, "%s: can't read bad block info (wrong type disk?)\n", name); exit(1); --- 97,103 ---- } lseek(f, 512 * (di->di_size - di->di_nsect), 0); printf("bad block information at 0x%X in %s:\n", ! lseek(f,0L,1), name); if (read(f, &dkbad, 512) != 512) { fprintf(stderr, "%s: can't read bad block info (wrong type disk?)\n", name); exit(1); *** /usr/lib/lint/llib-lc.old Thu Dec 15 20:27:35 1994 --- /usr/lib/lint/llib-lc Sun Jan 22 16:39:33 1995 *************** *** 1,4 **** ! /* @(#)llib-lc 1.38 (2.11BSD GTE) 11/29/94 */ /* LINTLIBRARY */ --- 1,4 ---- ! /* @(#)llib-lc 1.39 (2.11BSD GTE) 1/16/95 */ /* LINTLIBRARY */ *************** *** 12,18 **** #include #include #include - #include #include #include --- 12,17 ---- *************** *** 76,81 **** --- 75,81 ---- u_long gethostid() { return 1L; } int gethostname( n, l ) char *n; int l; { return 0 ;} int getitimer( w, v ) struct itimerval *v; { return 0; } + int getloadavg( d, n) double d[]; int n; { return 0; } int getpagesize() { return 1; } int getpeername(s, n, l) struct sockaddr *n; int *l; { return (0); } int getpgrp(p) { return 1; } *************** *** 88,94 **** int getsockopt( s, level, opt, buf, len ) char *buf; int *len; { return 0;} int gettimeofday( t, z ) struct timeval *t; struct timezone *z; { return 0;} uid_t getuid() { return((uid_t)1); } - int gldav(a) short *a; { return(0); } int ioctl( d, r, p) u_long r; char *p; { return 0;} int kill(p, s) { return(0); } int killpg( pg, s) { return 0;} --- 88,93 ---- *************** *** 165,170 **** --- 164,170 ---- int swapon( s ) char *s; { return 0;} int symlink( t, f) char *t, *f; { return 0;} sync(){;} + int sysctl(m, l, b, s, nv, nsz) int m[]; int l; void *b; size_t *s; void *nv; size_t nsz; { return 0; } int truncate( p, l) char *p; off_t l; { return 0;} int ucall(p, f, a0, a1) caddr_t f; { return(0); } int umask( n ) { return n; } *************** *** 297,304 **** int isatty(f) { return 1; } void l3tol(l, c, n) long *l; char *c; {;} double ldexp( v, e) double v; { return v; } ! void loadav(v) double *v; {;} ! longjmp( e, v) jmp_buf e; {;} longjmperror() {;} void ltol3(c, l, n) char *c; long *l; {;} struct tm *localtime(c) time_t *c; { return localtime(c); } --- 297,303 ---- int isatty(f) { return 1; } void l3tol(l, c, n) long *l; char *c; {;} double ldexp( v, e) double v; { return v; } ! void longjmp( e, v) jmp_buf e; {;} longjmperror() {;} void ltol3(c, l, n) char *c; long *l; {;} struct tm *localtime(c) time_t *c; { return localtime(c); } *************** *** 413,420 **** usleep(useconds) unsigned useconds; { ; } int utime(name, timep) char *name; time_t *timep; { return 0; } char * valloc(s) unsigned s; { return malloc(s); } - long vlimit(limit, value) long value; { return 0; } - int vtimes(par, ch) struct vtimes *par, *ch; { return 0; } /* standard I/O library */ --- 412,417 ---- *** /usr/src/lib/libc/gen/Makefile.old Sat Jan 1 13:55:28 1994 --- /usr/src/lib/libc/gen/Makefile Sun Jan 15 22:19:03 1995 *************** *** 3,9 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.7 (Berkeley) 3/26/86 # # Several routines have been rewritten in assembly language for the VAX and # the PDP. If you are not running on a VAX or PDP, you should use the --- 3,9 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.7.1 (2.11BSD GTE) 1/15/95 # # Several routines have been rewritten in assembly language for the VAX and # the PDP. If you are not running on a VAX or PDP, you should use the *************** *** 21,34 **** STDSRC= abort.c alarm.c atoi.c atol.c calloc.c closedir.c crypt.c \ ctime.c ctype_.c errlst.c execvp.c fakcu.c fstab.c gcvt.c getenv.c \ getgrent.c getgrgid.c getgrnam.c getlogin.c getpass.c getpwent.c \ getttyent.c getttynam.c getusershell.c getwd.c \ initgroups.c isatty.c malloc.c mktemp.c ndbm.c nlist.c \ opendir.c perror.c popen.c psignal.c qsort.c random.c readdir.c \ regex.c scandir.c seekdir.c setgid.c setegid.c setrgid.c setuid.c \ setenv.c seteuid.c setruid.c siglist.c signal.c siginterrupt.c \ ! sleep.c strcasecmp.c swab.c syslog.c system.c telldir.c time.c \ ! timezone.c ttyname.c ttyslot.c ualarm.c usleep.c valloc.c strdup.c \ ! strsep.c wait.c wait3.c waitpid.c VAXSRC= abs.c bcmp.c bcopy.c bzero.c fabs.c ffs.c frexp.c index.c insque.c \ rindex.c remque.c strcat.c strcmp.c strcpy.c strlen.c strncat.c \ strncmp.c strncpy.c --- 21,35 ---- STDSRC= abort.c alarm.c atoi.c atol.c calloc.c closedir.c crypt.c \ ctime.c ctype_.c errlst.c execvp.c fakcu.c fstab.c gcvt.c getenv.c \ getgrent.c getgrgid.c getgrnam.c getlogin.c getpass.c getpwent.c \ + getloadavg.c \ getttyent.c getttynam.c getusershell.c getwd.c \ initgroups.c isatty.c malloc.c mktemp.c ndbm.c nlist.c \ opendir.c perror.c popen.c psignal.c qsort.c random.c readdir.c \ regex.c scandir.c seekdir.c setgid.c setegid.c setrgid.c setuid.c \ setenv.c seteuid.c setruid.c siglist.c signal.c siginterrupt.c \ ! sleep.c strcasecmp.c swab.c sysctl.c syslog.c system.c telldir.c \ ! time.c timezone.c ttyname.c ttyslot.c ualarm.c usleep.c valloc.c \ ! strdup.c strsep.c wait.c wait3.c waitpid.c VAXSRC= abs.c bcmp.c bcopy.c bzero.c fabs.c ffs.c frexp.c index.c insque.c \ rindex.c remque.c strcat.c strcmp.c strcpy.c strlen.c strncat.c \ strncmp.c strncpy.c *************** *** 35,48 **** STDOBJ= abort.o alarm.o atoi.o atol.o calloc.o closedir.o crypt.o \ ctime.o ctype_.o errlst.o execvp.o fakcu.o fstab.o gcvt.o getenv.o \ getgrent.o getgrgid.o getgrnam.o getlogin.o getpass.o getpwent.o \ getttyent.o getttynam.o getusershell.o getwd.o \ initgroups.o isatty.o malloc.o mktemp.o ndbm.o nlist.o \ opendir.o perror.o popen.o psignal.o qsort.o random.o readdir.o \ regex.o scandir.o seekdir.o setgid.o setegid.o setrgid.o setuid.o \ setenv.o seteuid.o setruid.o siglist.o signal.o siginterrupt.o \ ! sleep.o strcasecmp.o swab.o syslog.o system.o telldir.o time.o \ ! timezone.o ttyname.o ttyslot.o ualarm.o usleep.o valloc.o strdup.o \ ! strsep.o wait.o wait3.o waitpid.o VAXOBJ= abs.o bcmp.o bcopy.o bzero.o fabs.c ffs.o frexp.o index.o insque.o \ rindex.o remque.o strcat.o strcmp.o strcpy.o strlen.o strncat.o \ strncmp.o strncpy.o --- 36,50 ---- STDOBJ= abort.o alarm.o atoi.o atol.o calloc.o closedir.o crypt.o \ ctime.o ctype_.o errlst.o execvp.o fakcu.o fstab.o gcvt.o getenv.o \ getgrent.o getgrgid.o getgrnam.o getlogin.o getpass.o getpwent.o \ + getloadavg.o \ getttyent.o getttynam.o getusershell.o getwd.o \ initgroups.o isatty.o malloc.o mktemp.o ndbm.o nlist.o \ opendir.o perror.o popen.o psignal.o qsort.o random.o readdir.o \ regex.o scandir.o seekdir.o setgid.o setegid.o setrgid.o setuid.o \ setenv.o seteuid.o setruid.o siglist.o signal.o siginterrupt.o \ ! sleep.o strcasecmp.o swab.o sysctl.o syslog.o system.o telldir.o \ ! time.o timezone.o ttyname.o ttyslot.o ualarm.o usleep.o valloc.o \ ! strdup.o strsep.o wait.o wait3.o waitpid.o VAXOBJ= abs.o bcmp.o bcopy.o bzero.o fabs.c ffs.o frexp.o index.o insque.o \ rindex.o remque.o strcat.o strcmp.o strcpy.o strlen.o strncat.o \ strncmp.o strncpy.o *** /usr/src/lib/libc/pdp/sys/Makefile.old Sun Nov 27 00:34:44 1994 --- /usr/src/lib/libc/pdp/sys/Makefile Fri Jan 13 22:15:30 1995 *************** *** 3,12 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.6.3 (2.11BSD GTE) 11/25/94 # ! SRCS= _exit.s accept.s access.s acct.s adjtime.s bind.s brk.s chdir.s \ ! chflags.s \ chmod.s chown.s chroot.s close.s connect.s creat.s dup.s dup2.s \ execl.s execle.s execv.s execve.s fchdir.s fchmod.s fchown.s fcntl.s \ fchflags.s \ --- 3,12 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.6.4 (2.11BSD GTE) 1/13/95 # ! SRCS= _exit.s __sysctl.s accept.s access.s acct.s adjtime.s bind.s brk.s \ ! chdir.s chflags.s \ chmod.s chown.s chroot.s close.s connect.s creat.s dup.s dup2.s \ execl.s execle.s execv.s execve.s fchdir.s fchmod.s fchown.s fcntl.s \ fchflags.s \ *************** *** 24,31 **** sigreturn.s sigsetmask.s sigstack.s sigvec.s socket.s socketpair.s \ stat.s symlink.s sync.s truncate.s umask.s umount.s unlink.s \ utimes.s vfork.s vhangup.s wait4.s write.s writev.s ! OBJS= _exit.o accept.o access.o acct.o adjtime.o bind.o brk.o chdir.o \ ! chflags.o \ chmod.o chown.o chroot.o close.o connect.o creat.o dup.o dup2.o \ execl.o execle.o execv.o execve.o fchdir.o fchmod.o fchown.o fcntl.o \ fchflags.o \ --- 24,31 ---- sigreturn.s sigsetmask.s sigstack.s sigvec.s socket.s socketpair.s \ stat.s symlink.s sync.s truncate.s umask.s umount.s unlink.s \ utimes.s vfork.s vhangup.s wait4.s write.s writev.s ! OBJS= _exit.o __sysctl.o accept.o access.o acct.o adjtime.o bind.o brk.o \ ! chdir.o chflags.o \ chmod.o chown.o chroot.o close.o connect.o creat.o dup.o dup2.o \ execl.o execle.o execv.o execve.o fchdir.o fchmod.o fchown.o fcntl.o \ fchflags.o \ *** /usr/src/lib/libc/pdp/compat-2.9/Makefile.old Sat Apr 9 01:48:58 1994 --- /usr/src/lib/libc/pdp/compat-2.9/Makefile Wed Jan 18 20:11:59 1995 *************** *** 3,12 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.7.1 (2.11BSD GTE) 4/9/94 # ! SRCS= fetchi.s fperr.s gldav.s l3.c loadav.c lock.s phys.s ucall.s ! OBJS= fetchi.o fperr.o gldav.o l3.o loadav.o lock.o phys.o ucall.o CFLAGS= -O ${DEFS} TAGSFILE=tags --- 3,12 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.7.2 (2.11BSD GTE) 1/18/95 # ! SRCS= fetchi.s fperr.s l3.c lock.s phys.s ucall.s ! OBJS= fetchi.o fperr.o l3.o lock.o phys.o ucall.o CFLAGS= -O ${DEFS} TAGSFILE=tags *************** *** 59,67 **** fetchi.o: fetchi.s ./SYS.h /usr/include/syscall.h fperr.o: fperr.s ./SYS.h /usr/include/syscall.h - gldav.o: gldav.s ./SYS.h /usr/include/syscall.h l3.o: l3.c - loadav.o: loadav.c lock.o: lock.s ./SYS.h /usr/include/syscall.h phys.o: phys.s ./SYS.h /usr/include/syscall.h ucall.o: ucall.s ./SYS.h /usr/include/syscall.h --- 59,65 ---- *** /usr/src/lib/libc/compat-4.1/Makefile.old Tue Jul 31 14:09:48 1990 --- /usr/src/lib/libc/compat-4.1/Makefile Sat Jan 21 17:54:29 1995 *************** *** 3,20 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.4 (Berkeley) 9/5/85 # CFLAGS= -O ${DEFS} ! STDSRCS=ftime.c gtty.c nice.c pause.c rand.c stty.c tell.c \ ! times.c utime.c vlimit.c vtimes.c ! STD= ftime.o gtty.o nice.o pause.o rand.o stty.o tell.o \ ! times.o utime.o vlimit.o vtimes.o ! # these should just be pitched, but in the interest of compatibility... ! TRASHSRC=getpw.c ! TRASH= getpw.o ! SRCS= ${STDSRCS} ${TRASHSRCS} ! OBJS= ${STD} ${TRASH} TAGSFILE=tags .c.o: --- 3,15 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.4.1 (2.11BSD GTE) 1/21/95 # CFLAGS= -O ${DEFS} ! SRCS=ftime.c gtty.c nice.c pause.c rand.c stty.c \ ! times.c utime.c ! OBJS= ftime.o gtty.o nice.o pause.o rand.o stty.o \ ! times.o utime.o TAGSFILE=tags .c.o: *************** *** 69,75 **** rand.o: rand.c stty.o: stty.c /usr/include/sgtty.h /usr/include/sys/ioctl.h stty.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h - tell.o: tell.c times.o: times.c /usr/include/sys/time.h /usr/include/time.h times.o: /usr/include/sys/resource.h utime.o: utime.c /usr/include/sys/time.h /usr/include/time.h --- 64,69 ---- *** /usr/src/usr.lib/sendmail/src/conf.c.old Fri Jul 15 15:40:22 1994 --- /usr/src/usr.lib/sendmail/src/conf.c Wed Jan 18 20:06:44 1995 *************** *** 9,15 **** */ #if !defined(lint) && !defined(NOSCCS) ! static char SccsId[] = "@(#)conf.c 5.14.2 (2.11BSD GTE) 7/15/94"; #endif # include --- 9,15 ---- */ #if !defined(lint) && !defined(NOSCCS) ! static char SccsId[] = "@(#)conf.c 5.14.3 (2.11BSD GTE) 1/18/95"; #endif # include *************** *** 512,581 **** ** none. */ - #ifdef VMUNIX - #ifdef pdp11 - getla() { ! double avenrun[3]; ! loadav(avenrun); ! return(avenrun[0]); } - - #else - - #include - - struct nlist Nl[] = - { - { "_avenrun" }, - #define X_AVENRUN 0 - { 0 }, - }; - - getla() - { - static int kmem = -1; - # ifdef sun - long avenrun[3]; - # else - double avenrun[3]; - # endif - extern off_t lseek(); - - if (kmem < 0) - { - kmem = open("/dev/kmem", 0, 0); - if (kmem < 0) - return (-1); - (void) ioctl(kmem, FIOCLEX, (char *) 0); - nlist("/vmunix", Nl); - if (Nl[0].n_type == 0) - return (-1); - } - if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, 0) == -1 || - read(kmem, (char *) avenrun, sizeof(avenrun)) < (int)sizeof(avenrun)) - { - /* thank you Ian */ - return (-1); - } - # ifdef sun - return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT); - # else - return ((int) (avenrun[0] + 0.5)); - # endif - } - - #endif pdp11 - #else VMUNIX - - getla() - { - return (0); - } - - #endif VMUNIX /* ** SHOULDQUEUE -- should this message be queued or sent? ** --- 512,524 ---- ** none. */ getla() { ! double avenrun; ! getloadavg(&avenrun, 1); ! return(avenrun); } /* ** SHOULDQUEUE -- should this message be queued or sent? ** *** /usr/src/man/man2/Makefile.old Tue Dec 13 19:47:19 1994 --- /usr/src/man/man2/Makefile Wed Jan 18 20:21:15 1995 *************** *** 14,20 **** # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. # ! # @(#)Makefile 2.3 (2.11BSD GTE) 12/12/94 # MDIR= /usr/man/cat2 SRCS= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chmod.2 \ --- 14,20 ---- # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. # ! # @(#)Makefile 2.4 (2.11BSD GTE) 1/18/95 # MDIR= /usr/man/cat2 SRCS= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chmod.2 \ *************** *** 24,30 **** getgid.2 getgroups.2 gethostid.2 gethostname.2 getitimer.2 \ getpagesize.2 getpeername.2 getpgrp.2 getpid.2 getpriority.2 \ getrlimit.2 getrusage.2 getsockname.2 getsockopt.2 gettimeofday.2 \ ! getuid.2 gldav.2 intro.2 ioctl.2 kill.2 killpg.2 link.2 listen.2 \ lock.2 lseek.2 mkdir.2 mknod.2 mount.2 nostk.2 open.2 phys.2 \ pipe.2 profil.2 ptrace.2 quota.2 read.2 readlink.2 reboot.2 \ recv.2 rename.2 rmdir.2 select.2 send.2 setgroups.2 setpgrp.2 \ --- 24,30 ---- getgid.2 getgroups.2 gethostid.2 gethostname.2 getitimer.2 \ getpagesize.2 getpeername.2 getpgrp.2 getpid.2 getpriority.2 \ getrlimit.2 getrusage.2 getsockname.2 getsockopt.2 gettimeofday.2 \ ! getuid.2 intro.2 ioctl.2 kill.2 killpg.2 link.2 listen.2 \ lock.2 lseek.2 mkdir.2 mknod.2 mount.2 nostk.2 open.2 phys.2 \ pipe.2 profil.2 ptrace.2 quota.2 read.2 readlink.2 reboot.2 \ recv.2 rename.2 rmdir.2 select.2 send.2 setgroups.2 setpgrp.2 \ *************** *** 39,45 **** getgid.0 getgroups.0 gethostid.0 gethostname.0 getitimer.0 \ getpagesize.0 getpeername.0 getpgrp.0 getpid.0 getpriority.0 \ getrlimit.0 getrusage.0 getsockname.0 getsockopt.0 gettimeofday.0 \ ! getuid.0 gldav.0 intro.0 ioctl.0 kill.0 killpg.0 link.0 listen.0 \ lock.0 lseek.0 mkdir.0 mknod.0 mount.0 nostk.0 open.0 phys.0 \ pipe.0 profil.0 ptrace.0 quota.0 read.0 readlink.0 reboot.0 \ recv.0 rename.0 rmdir.0 select.0 send.0 setgroups.0 setpgrp.0 \ --- 39,45 ---- getgid.0 getgroups.0 gethostid.0 gethostname.0 getitimer.0 \ getpagesize.0 getpeername.0 getpgrp.0 getpid.0 getpriority.0 \ getrlimit.0 getrusage.0 getsockname.0 getsockopt.0 gettimeofday.0 \ ! getuid.0 intro.0 ioctl.0 kill.0 killpg.0 link.0 listen.0 \ lock.0 lseek.0 mkdir.0 mknod.0 mount.0 nostk.0 open.0 phys.0 \ pipe.0 profil.0 ptrace.0 quota.0 read.0 readlink.0 reboot.0 \ recv.0 rename.0 rmdir.0 select.0 send.0 setgroups.0 setpgrp.0 \ *** /usr/src/man/man3/Makefile.old Mon Jan 18 09:33:52 1993 --- /usr/src/man/man3/Makefile Sat Jan 21 20:09:02 1995 *************** *** 14,20 **** # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. # ! # @(#)Makefile 5.4 (Berkeley) 7/9/88 # MDIR= /usr/man/cat3 SRCS1= abort.3 abs.3 alarm.3 asinh.3 assert.3 atof.3 bstring.3 byteorder.3 \ --- 14,20 ---- # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. # ! # @(#)Makefile 5.4.1 (2.11BSD GTE) 1/15/95 # MDIR= /usr/man/cat3 SRCS1= abort.3 abs.3 alarm.3 asinh.3 assert.3 atof.3 bstring.3 byteorder.3 \ *************** *** 22,52 **** ecvt.3 end.3 erf.3 execl.3 exit.3 exp.3 fclose.3 ferror.3 floor.3 \ fopen.3 fread.3 frexp.3 fseek.3 getc.3 getdisk.3 getenv.3 getfsent.3 \ getgrent.3 gethostbyname.3 getlogin.3 getnetent.3 getopt.3 getpass.3 \ ! getprotoent.3 getpw.3 getpwent.3 gets.3 getservent.3 getttyent.3 \ getusershell.3 getwd.3 hypot.3 ieee.3 inet.3 infnan.3 initgroups.3 ! SRCS2= insque.3 intro.3 j0.3 l3tol.3 ldfps.3 lgamma.3 lib2648.3 loadav.3 \ malloc.3 math.3 mktemp.3 monitor.3 mp.3 ndbm.3 nice.3 nlist.3 ns.3 \ pause.3 perror.3 plot.3 popen.3 printf.3 psignal.3 putc.3 puts.3 \ qsort.3 rand.3 random.3 rcmd.3 regex.3 resolver.3 rexec.3 scandir.3 \ scanf.3 setbuf.3 setjmp.3 setuid.3 siginterrupt.3 signal.3 sin.3 \ ! sinh.3 sleep.3 sqrt.3 stdio.3 string.3 strtok.3 stty.3 swab.3 syslog.3 \ system.3 termcap.3 time.3 times.3 ttyname.3 ualarm.3 ungetc.3 \ ! usleep.3 utime.3 valloc.3 varargs.3 vlimit.3 vtimes.3 OBJS1= abort.0 abs.0 alarm.0 asinh.0 assert.0 atof.0 bstring.0 byteorder.0 \ compat-sys5.0 crypt.0 ctime.0 ctype.0 curses.0 dbm.0 directory.0 \ ecvt.0 end.0 erf.0 execl.0 exit.0 exp.0 fclose.0 ferror.0 floor.0 \ fopen.0 fread.0 frexp.0 fseek.0 getc.0 getdisk.0 getenv.0 getfsent.0 \ getgrent.0 gethostbyname.0 getlogin.0 getnetent.0 getopt.0 getpass.0 \ ! getprotoent.0 getpw.0 getpwent.0 gets.0 getservent.0 getttyent.0 \ getusershell.0 getwd.0 hypot.0 ieee.0 inet.0 infnan.0 initgroups.0 ! OBJS2= insque.0 intro.0 j0.0 l3tol.0 ldfps.0 lgamma.0 lib2648.0 loadav.0 \ malloc.0 math.0 mktemp.0 monitor.0 mp.0 ndbm.0 nice.0 nlist.0 ns.0 \ pause.0 perror.0 plot.0 popen.0 printf.0 psignal.0 putc.0 puts.0 \ qsort.0 rand.0 random.0 rcmd.0 regex.0 resolver.0 rexec.0 scandir.0 \ scanf.0 setbuf.0 setjmp.0 setuid.0 siginterrupt.0 signal.0 sin.0 \ ! sinh.0 sleep.0 sqrt.0 stdio.0 string.0 strtok.0 stty.0 swab.0 syslog.0 \ system.0 termcap.0 time.0 times.0 ttyname.0 ualarm.0 ungetc.0 \ ! usleep.0 utime.0 valloc.0 varargs.0 vlimit.0 vtimes.0 REMO1= edata.0 etext.0 j1.0 jn.0 ns_addr.0 ns_ntoa.0 y0.0 y1.0 yn.0 acos.0 \ asin.0 atan.0 atan2.0 atoi.0 atol.0 cos.0 dbm_clearerr.0 dbm_close.0 \ dbm_delete.0 dbm_error.0 dbm_fetch.0 dbm_firstkey.0 dbm_nextkey.0 \ --- 22,56 ---- ecvt.3 end.3 erf.3 execl.3 exit.3 exp.3 fclose.3 ferror.3 floor.3 \ fopen.3 fread.3 frexp.3 fseek.3 getc.3 getdisk.3 getenv.3 getfsent.3 \ getgrent.3 gethostbyname.3 getlogin.3 getnetent.3 getopt.3 getpass.3 \ ! getloadavg.3 \ ! getprotoent.3 getpwent.3 gets.3 getservent.3 getttyent.3 \ getusershell.3 getwd.3 hypot.3 ieee.3 inet.3 infnan.3 initgroups.3 ! SRCS2= insque.3 intro.3 j0.3 l3tol.3 ldfps.3 lgamma.3 lib2648.3 \ malloc.3 math.3 mktemp.3 monitor.3 mp.3 ndbm.3 nice.3 nlist.3 ns.3 \ pause.3 perror.3 plot.3 popen.3 printf.3 psignal.3 putc.3 puts.3 \ qsort.3 rand.3 random.3 rcmd.3 regex.3 resolver.3 rexec.3 scandir.3 \ scanf.3 setbuf.3 setjmp.3 setuid.3 siginterrupt.3 signal.3 sin.3 \ ! sinh.3 sleep.3 sqrt.3 stdio.3 string.3 strtok.3 stty.3 swab.3 \ ! sysctl.3 syslog.3 \ system.3 termcap.3 time.3 times.3 ttyname.3 ualarm.3 ungetc.3 \ ! usleep.3 utime.3 valloc.3 varargs.3 OBJS1= abort.0 abs.0 alarm.0 asinh.0 assert.0 atof.0 bstring.0 byteorder.0 \ compat-sys5.0 crypt.0 ctime.0 ctype.0 curses.0 dbm.0 directory.0 \ ecvt.0 end.0 erf.0 execl.0 exit.0 exp.0 fclose.0 ferror.0 floor.0 \ fopen.0 fread.0 frexp.0 fseek.0 getc.0 getdisk.0 getenv.0 getfsent.0 \ getgrent.0 gethostbyname.0 getlogin.0 getnetent.0 getopt.0 getpass.0 \ ! getprotoent.0 getpwent.0 gets.0 getservent.0 getttyent.0 \ ! getloadavg.0 \ getusershell.0 getwd.0 hypot.0 ieee.0 inet.0 infnan.0 initgroups.0 ! OBJS2= insque.0 intro.0 j0.0 l3tol.0 ldfps.0 lgamma.0 lib2648.0 \ malloc.0 math.0 mktemp.0 monitor.0 mp.0 ndbm.0 nice.0 nlist.0 ns.0 \ pause.0 perror.0 plot.0 popen.0 printf.0 psignal.0 putc.0 puts.0 \ qsort.0 rand.0 random.0 rcmd.0 regex.0 resolver.0 rexec.0 scandir.0 \ scanf.0 setbuf.0 setjmp.0 setuid.0 siginterrupt.0 signal.0 sin.0 \ ! sinh.0 sleep.0 sqrt.0 stdio.0 string.0 strtok.0 stty.0 swab.0 \ ! sysctl.0 syslog.0 \ system.0 termcap.0 time.0 times.0 ttyname.0 ualarm.0 ungetc.0 \ ! usleep.0 utime.0 valloc.0 varargs.0 REMO1= edata.0 etext.0 j1.0 jn.0 ns_addr.0 ns_ntoa.0 y0.0 y1.0 yn.0 acos.0 \ asin.0 atan.0 atan2.0 atoi.0 atol.0 cos.0 dbm_clearerr.0 dbm_close.0 \ dbm_delete.0 dbm_error.0 dbm_fetch.0 dbm_firstkey.0 dbm_nextkey.0 \ *** /usr/src/new/jove/util.c.old Sat Jan 1 01:33:02 1994 --- /usr/src/new/jove/util.c Mon Jan 16 23:42:49 1995 *************** *** 5,10 **** --- 5,15 ---- * included in all the files. * ***************************************************************************/ + /* + * Modified 1/16/95. The loadaverage method has changed. You will need + * 'getloadavg()' now. Heck, if 'mere' pdp-11s have it anyone can ;-). + */ + #include "jove.h" #include "ctype.h" #include "termcap.h" *************** *** 688,764 **** byte_copy((char *) savejmp, (char *) mainjmp, sizeof (jmp_buf)); } - #ifdef LOAD_AV - # if defined(BSD4_2) && !defined(pdp11) - # if defined(PURDUE_EE) && (defined(vax) || defined(gould)) - void get_la(dp) - double *dp; - { - *dp = (double) loadav(0) / 100.0; - } - - # else /* !PURDUE_EE || (!vax && !gould) */ - - #ifdef sun - # include - #endif - #include - - static struct nlist nl[] = { - { "_avenrun" }, - #define X_AVENRUN 0 - { "" } - }; - - void - get_la(dp) double *dp; { - #ifdef sun - long avenrun[3]; - #else - double avenrun[3]; - #endif - static int kmem = 0; ! if (kmem == -1) { ! *dp = 4.0; /* So shell commands will say "Chugging" */ ! return; ! } else if (kmem == 0) { ! if ((kmem = open("/dev/kmem", 0)) == -1) { ! f_mess("Can't open kmem for load average."); ! *dp = 4.0; ! return; ! } ! nlist("/vmunix", nl); ! } ! lseek(kmem, (long) nl[X_AVENRUN].n_value, 0); ! read(kmem, (char *) avenrun, sizeof(avenrun)); ! #ifdef sun ! *dp = (double) avenrun[0] / FSCALE; ! #else ! *dp = avenrun[0]; ! #endif } - # endif - # else /* !BSD4_2 || pdp11 */ - - void - get_la(dp) - double *dp; - { - short avg[3]; - - gldav(avg); - *dp = (double) avg[0] / 256; - } - - # endif - #endif /* LOAD_AV */ - /* get the time buf, designated by *timep, from FROM to TO. */ char * get_time(timep, buf, from, to) --- 693,706 ---- byte_copy((char *) savejmp, (char *) mainjmp, sizeof (jmp_buf)); } void get_la(dp) double *dp; { ! getloadavg(dp, 1); } /* get the time buf, designated by *timep, from FROM to TO. */ char * get_time(timep, buf, from, to) *************** *** 787,806 **** return buf; } else return cp; - } - - char * - index(s, c) - register char *s; - register int c; - { - register int c1; - - if (c != 0) - while (c1 = *s++) - if (c == c1) - return s - 1; - return 0; } #if !(defined(MSDOS) || defined(MAC)) --- 729,734 ---- *** /usr/src/new/la/la.c.old Wed May 25 16:15:54 1983 --- /usr/src/new/la/la.c Mon Jan 16 20:44:28 1995 *************** *** 5,12 **** { double vec[3]; ! if (loadav(vec) < 0) { ! perror("loadav: gldav"); exit(1); } printf("load %.02f %.02f %.02f\n", vec[0], vec[1], vec[2]); --- 5,12 ---- { double vec[3]; ! if (getloadavg(vec, 3) < 0) { ! perror("la: getloadavg"); exit(1); } printf("load %.02f %.02f %.02f\n", vec[0], vec[1], vec[2]); *** /usr/src/ucb/w.c.old Sun Jan 16 21:39:04 1994 --- /usr/src/ucb/w.c Thu Jan 19 22:55:00 1995 *************** *** 1,14 **** /* * w - print system status (who and what) * * This program is similar to the systat command on Tenex/Tops 10/20 * It needs read permission on /dev/mem and /dev/swap. */ #include ! #include #include #include #include #include #include #include --- 1,17 ---- /* * w - print system status (who and what) * + * Rewritten using sysctl, no nlist used - 1/19/94 - sms. + * * This program is similar to the systat command on Tenex/Tops 10/20 * It needs read permission on /dev/mem and /dev/swap. */ #include ! #include #include #include #include + #include #include #include #include *************** *** 31,63 **** char w_args[ARGWIDTH+1]; /* args if interesting process */ } *pr; - struct nlist nl[] = { - { "_proc" }, - #define X_PROC 0 - { "_swapdev" }, - #define X_SWAPDEV 1 - { "_avenrun" }, - #define X_AVENRUN 2 - { "_boottime" }, - #define X_BOOTIME 3 - { "_nproc" }, - #define X_NPROC 4 - { 0 }, - }; - - FILE *ps; FILE *ut; - FILE *bootfd; int swmem; - int mem; int swap; /* /dev/mem, mem, and swap */ - int nswap; int file; dev_t tty; char doing[520]; /* process attached to terminal */ time_t proctime; /* cpu time of process in doing */ ! short avenrun[3]; ! double load[3]; #define DIV60(t) ((t+30)/60) /* x/60 rounded */ #define TTYEQ (tty == pr[i].w_tty) --- 34,48 ---- char w_args[ARGWIDTH+1]; /* args if interesting process */ } *pr; FILE *ut; int swmem; int swap; /* /dev/mem, mem, and swap */ int file; dev_t tty; char doing[520]; /* process attached to terminal */ time_t proctime; /* cpu time of process in doing */ ! double avenrun[3]; ! extern int errno, optind; #define DIV60(t) ((t+30)/60) /* x/60 rounded */ #define TTYEQ (tty == pr[i].w_tty) *************** *** 65,166 **** long round(); char *getargs(); - char *fread(); - char *ctime(); - char *rindex(); char *getptr(); - FILE *popen(); - struct tm *localtime(); ! int debug; /* true if -d flag: debugging output */ int header = 1; /* true if -h flag: don't print heading */ int lflag = 1; /* true if -l flag: long style output */ - int login; /* true if invoked as login shell */ time_t idle; /* number of minutes user is idle */ int nusers; /* number of users logged in now */ char * sel_user; /* login of particular user selected */ ! char firstchar; /* first char of name of prog invoked as */ time_t jobtime; /* total cpu time visible */ time_t now; /* the current time of day */ struct tm *nowt; /* current time as time struct */ ! time_t boottime, uptime; /* time of last reboot & elapsed time since */ int np; /* number of processes currently active */ struct utmp utmp; - struct proc mproc; struct user up; - char fill[512]; ! struct map { long b1, e1; long f1; long b2, e2; long f2; }; ! struct map datmap; main(argc, argv) char **argv; { int days, hrs, mins; ! register int i, j; char *cp; register int curpid, empty; ! login = (argv[0][0] == '-'); ! cp = rindex(argv[0], '/'); ! firstchar = login ? argv[0][1] : (cp==0) ? argv[0][0] : cp[1]; ! cp = argv[0]; /* for Usage */ ! while (argc > 1) { ! if (argv[1][0] == '-') { ! for (i=1; argv[1][i]; i++) { ! switch(argv[1][i]) { ! ! case 'd': ! debug++; ! break; ! ! case 'h': ! header = 0; ! break; ! ! case 'l': ! lflag++; ! break; ! ! case 's': ! lflag = 0; ! break; ! ! case 'u': ! case 'w': ! firstchar = argv[1][1]; ! break; ! ! default: ! printf("Bad flag %s\n", argv[1]); ! exit(1); ! } ! } ! } else { ! if (!isalnum(argv[1][0]) || argc > 2) { ! printf("Usage: %s [ -hlsuw ] [ user ]\n", cp); exit(1); ! } else ! sel_user = argv[1]; } ! argc--; argv++; ! } ! if ((mem = open("/dev/kmem", 0)) < 0) { ! fprintf(stderr, "No mem\n"); ! exit(1); ! } ! nlist("/unix", nl); ! if (nl[0].n_type==0) { ! fprintf(stderr, "No namelist\n"); ! exit(1); ! } ! ! if (firstchar != 'u') readpr(); ut = fopen("/etc/utmp","r"); --- 50,126 ---- long round(); char *getargs(); char *getptr(); ! char *program; int header = 1; /* true if -h flag: don't print heading */ int lflag = 1; /* true if -l flag: long style output */ time_t idle; /* number of minutes user is idle */ int nusers; /* number of users logged in now */ char * sel_user; /* login of particular user selected */ ! int wcmd = 1; /* running as the w command */ time_t jobtime; /* total cpu time visible */ time_t now; /* the current time of day */ struct tm *nowt; /* current time as time struct */ ! struct timeval boottime; /* time since last reboot */ ! time_t uptime; /* elapsed time since */ int np; /* number of processes currently active */ struct utmp utmp; struct user up; ! struct addrmap { long b1, e1; long f1; long b2, e2; long f2; }; ! struct addrmap datmap; main(argc, argv) char **argv; { int days, hrs, mins; ! register int i; char *cp; register int curpid, empty; + size_t size; + int mib[2]; ! program = argv[0]; ! if ((cp = rindex(program, '/')) || *(cp = program) == '-') ! cp++; ! if (*cp == 'u') ! wcmd = 0; ! while ((i = getopt(argc, argv, "hlswu")) != EOF) ! { ! switch (i) ! { ! case 'h': ! header = 0; ! break; ! case 'l': ! lflag++; ! break; ! case 's': ! lflag = 0; ! break; ! case 'u': ! wcmd = 0; ! break; ! case 'w': ! wcmd = 1; ! break; ! default: ! fprintf(stderr, "Usage: %s [-hlswu] [user]\n", ! program); exit(1); ! } } ! argc -= optind; ! argv += optind; ! if (*argv) ! sel_user = *argv; ! if (wcmd) readpr(); ut = fopen("/etc/utmp","r"); *************** *** 170,184 **** nowt = localtime(&now); prtat(nowt); ! if (nl[X_BOOTIME].n_type > 0) { ! /* ! * Print how long system has been up. ! * (Found by looking for "boottime" in kernel) ! */ ! lseek(mem, (long)nl[X_BOOTIME].n_value, 0); ! read(mem, &boottime, sizeof (boottime)); ! ! uptime = now - boottime; days = uptime / (60L*60L*24L); uptime %= (60L*60L*24L); hrs = uptime / (60L*60L); --- 130,141 ---- nowt = localtime(&now); prtat(nowt); ! mib[0] = CTL_KERN; ! mib[1] = KERN_BOOTTIME; ! size = sizeof (boottime); ! if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && ! boottime.tv_sec != 0) { ! uptime = now - boottime.tv_sec; days = uptime / (60L*60L*24L); uptime %= (60L*60L*24L); hrs = uptime / (60L*60L); *************** *** 206,228 **** rewind(ut); printf(" %d user%c", nusers, nusers > 1 ? 's' : '\0'); ! if (nl[X_AVENRUN].n_type > 0) { ! /* ! * Print 1, 5, and 15 minute load averages. ! * (Found by looking in kernel for avenrun). ! */ ! printf(", load average:"); ! lseek(mem, (long)nl[X_AVENRUN].n_value, 0); ! read(mem, avenrun, sizeof(avenrun)); for (i = 0; i < (sizeof(avenrun)/sizeof(avenrun[0])); i++) { - load[i] = avenrun[i] / 256.0; if (i > 0) printf(","); ! printf(" %.2f", load[i]); } } printf("\n"); ! if (firstchar == 'u') exit(0); /* Headers for rest of output */ --- 163,180 ---- rewind(ut); printf(" %d user%c", nusers, nusers > 1 ? 's' : '\0'); ! if (getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])) == -1) ! printf(", no load average information available\n"); ! else { ! printf(", load averages:"); for (i = 0; i < (sizeof(avenrun)/sizeof(avenrun[0])); i++) { if (i > 0) printf(","); ! printf(" %.2f", avenrun[i]); } } printf("\n"); ! if (wcmd == 0) exit(0); /* Headers for rest of output */ *************** *** 258,272 **** continue; jobtime += pr[i].w_time + pr[i].w_ctime; proctime += pr[i].w_time; - if (debug) { - printf("\t\t%d\t%s", pr[i].w_pid, pr[i].w_args); - if ((j=pr[i].w_igintr) > 0) - if (j==IGINT) - printf(" &"); - else - printf(" & %d %d", j%3, j/3); - printf("\n"); - } if (empty && pr[i].w_igintr!=IGINT) { empty = 0; curpid = -1; --- 210,215 ---- *************** *** 303,309 **** */ putline() { - register int tm; /* print login name of the user */ printf("%-*.*s ", NMAX, NMAX, utmp.ut_name); --- 246,251 ---- *************** *** 385,394 **** /* prtat prints a 12 hour time given a pointer to a time of day */ prtat(p) ! struct tm *p; { register int pm; ! register time_t t; t = p -> tm_hour; pm = (t > 11); --- 327,336 ---- /* prtat prints a 12 hour time given a pointer to a time of day */ prtat(p) ! register struct tm *p; { register int pm; ! time_t t; t = p -> tm_hour; pm = (t > 11); *************** *** 405,416 **** */ readpr() { ! int pn, mf, c, nproc; ! int szpt, pfnum, i; ! long addr; ! long daddr, saddr; long txtsiz, datsiz, stksiz; int septxt; if((swmem = open("/dev/mem", 0)) < 0) { perror("/dev/mem"); --- 347,362 ---- */ readpr() { ! struct kinfo_proc *kp; ! register struct proc *p; ! register struct smproc *smp; ! struct kinfo_proc *kpt; ! int pn, nproc; ! long addr, daddr, saddr; long txtsiz, datsiz, stksiz; int septxt; + int mib[4], st; + size_t size; if((swmem = open("/dev/mem", 0)) < 0) { perror("/dev/mem"); *************** *** 420,436 **** perror("/dev/swap"); exit(1); } ! /* ! * read mem to find swap dev. ! */ ! lseek(mem, (long)nl[X_SWAPDEV].n_value, 0); ! read(mem, &nl[X_SWAPDEV].n_value, sizeof(nl[X_SWAPDEV].n_value)); ! if (nl[X_NPROC].n_value == 0) { ! fprintf(stderr, "nproc not in namelist\n"); exit(1); } ! lseek (mem, (off_t) nl[X_NPROC].n_value, 0); ! read(mem, (char *)&nproc, sizeof(nproc)); pr = (struct smproc *) malloc(nproc * sizeof(struct smproc)); if (pr == (struct smproc *)NULL) { fprintf(stderr,"Not enough memory for proc table\n"); --- 366,398 ---- perror("/dev/swap"); exit(1); } ! mib[0] = CTL_KERN; ! mib[1] = KERN_PROC; ! mib[2] = KERN_PROC_ALL; ! size = 0; ! st = sysctl(mib, 4, NULL, &size, NULL, 0); ! if (st == -1) { ! fprintf(stderr, "sysctl: %s \n", strerror(errno)); exit(1); } ! if (size % sizeof (struct kinfo_proc) != 0) { ! fprintf(stderr, "proc size mismatch (%d total, %d chunks)\n", ! size, sizeof(struct kinfo_proc)); ! exit(1); ! } ! kpt = (struct kinfo_proc *)malloc(size); ! if (kpt == (struct kinfo_proc *)NULL) { ! fprintf(stderr, "Not %d bytes of memory for proc table\n", ! size); ! exit(1); ! } ! if (sysctl(mib, 4, kpt, &size, NULL, 0) == -1) { ! fprintf(stderr, "sysctl fetch of proc table failed: %s\n", ! strerror(errno)); ! exit(1); ! } ! ! nproc = size / sizeof (struct kinfo_proc); pr = (struct smproc *) malloc(nproc * sizeof(struct smproc)); if (pr == (struct smproc *)NULL) { fprintf(stderr,"Not enough memory for proc table\n"); *************** *** 437,461 **** exit(1); } /* ! * Locate proc table */ ! np = 0; ! for (pn=0; pnkp_proc; /* decide if it's an interesting process */ ! if (p->p_stat==0 || p->p_stat==SZOMB || p->p_pgrp==0) continue; /* find & read in the user structure */ ! if (p->p_flag & SLOAD) { ! addr = ctob((long)p->p_addr); ! daddr = ctob((long)p->p_daddr); ! saddr = ctob((long)p->p_saddr); file = swmem; } else { ! addr = (off_t)p->p_addr<<9; ! daddr = (off_t)p->p_daddr<<9; ! saddr = (off_t)p->p_saddr<<9; file = swap; } lseek(file, addr, 0); *************** *** 477,504 **** datmap.f2 = saddr; /* save the interesting parts */ ! pr[np].w_addr = saddr + ctob((long)mproc.p_ssize) - ARGLIST; ! pr[np].w_pid = mproc.p_pid; ! pr[np].w_igintr = (int)(((up.u_signal[2]==1) + 2*(up.u_signal[2]>1) + 3*(up.u_signal[3]==1)) + 6*(up.u_signal[3]>1)); ! pr[np].w_time = up.u_ru.ru_utime + up.u_ru.ru_stime; ! pr[np].w_ctime = up.u_cru.ru_utime + up.u_cru.ru_stime; ! pr[np].w_tty = up.u_ttyd; up.u_comm[14] = 0; /* Bug: This bombs next field. */ ! strcpy(pr[np].w_comm, up.u_comm); /* * Get args if there's a chance we'll print it. * Cant just save pointer: getargs returns static place. * Cant use strncpy: that crock blank pads. */ ! pr[np].w_args[0] = 0; ! strncat(pr[np].w_args,getargs(&pr[np]),ARGWIDTH); ! if (pr[np].w_args[0]==0 || pr[np].w_args[0]=='-' && pr[np].w_args[1]<=' ' || pr[np].w_args[0] == '?') { ! strcat(pr[np].w_args, " ("); ! strcat(pr[np].w_args, pr[np].w_comm); ! strcat(pr[np].w_args, ")"); } ! np++; } } /* --- 440,469 ---- datmap.f2 = saddr; /* save the interesting parts */ ! smp->w_addr = saddr + ctob((long)p->p_ssize) - ARGLIST; ! smp->w_pid = p->p_pid; ! smp->w_igintr = (int)(((up.u_signal[2]==1) + 2*(up.u_signal[2]>1) + 3*(up.u_signal[3]==1)) + 6*(up.u_signal[3]>1)); ! smp->w_time = up.u_ru.ru_utime + up.u_ru.ru_stime; ! smp->w_ctime = up.u_cru.ru_utime + up.u_cru.ru_stime; ! smp->w_tty = up.u_ttyd; up.u_comm[14] = 0; /* Bug: This bombs next field. */ ! strcpy(smp->w_comm, up.u_comm); /* * Get args if there's a chance we'll print it. * Cant just save pointer: getargs returns static place. * Cant use strncpy: that crock blank pads. */ ! smp->w_args[0] = 0; ! strncat(smp->w_args,getargs(smp),ARGWIDTH); ! if (smp->w_args[0]==0 || smp->w_args[0]=='-' && smp->w_args[1]<=' ' || smp->w_args[0] == '?') { ! strcat(smp->w_args, " ("); ! strcat(smp->w_args, smp->w_comm); ! strcat(smp->w_args, ")"); } ! smp++; } + np = smp - pr; + free(kpt); } /* *************** *** 578,589 **** return (p->w_comm); } - min(a, b) - { - - return (a < b ? a : b); - } - char * getptr(adr) char **adr; --- 543,548 ---- *************** *** 603,609 **** getbyte(adr) char *adr; { ! register struct map *amap = &datmap; char b; long saddr; --- 562,568 ---- getbyte(adr) char *adr; { ! register struct addrmap *amap = &datmap; char b; long saddr;