Subject: securelevel support incomplete, 'sysctl' missing (#223 - part 5 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 5 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 updated by this part of the update kit: /usr/src/new/rn/intrp.c /usr/src/usr.bin/refer/what1.c /usr/src/local/welcome/welcome.c /usr/src/local/welcome/cpu.h /usr/src/local/welcome/Makefile /usr/src/games/warp/score.c /usr/src/games/warp/intrp.c /usr/src/games/warp/warp.h /usr/src/games/mille/mille.c /usr/src/games/snake/busy.c /usr/src/games/snake/Makefile /usr/src/games/canfield.c /usr/src/usr.lib/lpr/filters/rotate.c /usr/src/usr.lib/lpr/filters/rotprt.c /usr/src/usr.lib/sendmail.MX/src/conf.c /VERSION Several of the games used 'loadav' or 'gldav'. These programs were updated to use 'getloadavg'. A couple of the programs ('rn/interp.c' and the lpr/filters/*) probably were not worth the effort - these programs are not used because of size constraints (rn is an old version anyhow) or the hardware no longer exists (who is using the particular model of Versatec plotter that lpr/filters/rotate.c deals with?). But in the interest of completeness these files were updated. Instructions: 1) Cut where indicated and save to a file (/tmp/foo) 2) patch -p0 < /tmp/foo NOW IT IS TIME to compile things. The first thing that needs to be built is a new kernel. REMEMBER: you have to add kern_sysctl.o to one of the overlays where there is space (OV6 or OV7 usually are good choices but if they are full then use OV8). 1) cd /sys/YOURKERNEL cp ../conf/Make.sys Make.sys make Then if the compile is successful: mv /unix /ounix mv /netnix /onetnix mv unix netnix / chmod 744 /unix /netnix And then reboot. The new kernel is 100% compatible with old binaries - not surprising really since none of the applications have been rebuilt yet. 2) Now the real fun begins - go get yourself a liter of your favorite brew and settle in for an evening of 'make's. The first order of business is to remake libc.a: cd /usr/src/lib/libc make make install make clean (this takes about 84 minutes on a 11/73) 3) Next we will rebuild 'init'. Before you do this be _absolutely_ certain that you have a bootable backup!!! While nothing bad _should_ happen in this step, init's role is so critical that if anything does go wrong your system will be unbootable. Here is how to create a bootable backup: cd /sys/pdpstand make ./maketape /dev/nrmt0 maketape.data dump 0f /dev/nrmt0 / this will put a dump image of the root filesystem on a bootable tape. BE SURE TO USE the 'n' form of the tape device when running the 'maketape' command. cd /usr/src/etc make init install -s -m 755 init /etc/init reboot When the system comes back up you should see the message: "kernel security level changed from 0 to 1" displayed on the console just as the system goes multiuser. 4) The hard part is over now. The rest of the evening will be routine, non system threatening, compiles and installs. Hmmm - what to do first... AH, something easy like the libc lint library. cd /usr/src/usr.bin/lint ./libs (the above requires patch #218 to be installed or else lint will bomb on the "void *" declarations in llib-lc). cd /usr/src/bin/adb make make install make clean cd /usr/src/bin/ld make make install make clean cd /usr/src/bin/sysctl make make install make clean cd /usr/src/etc make rwhod bad144 install -s -m 755 rwhod bad144 /etc/rwhod At this point you may wish to kill the running 'rwhod' (if you run it) and start the new one. Now some "fun" stuff - the games ;-) cd /usr/src/games/warp make make install make clean cd /usr/src/games/mille make make install make clean cd /usr/src/games/snake make make install make clean cd /usr/src/games make canfield install -m 755 -s canfield /usr/games Back to more serious stuff: cd /usr/src/local/welcome cp -p /usr/local/welcome /usr/local/welcome.old make welcome make install make clean To see the difference that sysctl() makes - try running 'welcome' first and then 'welcome.old'! cd /usr/src/new/jove make make install make clean cd /usr/src/new/la make make install make clean cd /usr/src/ucb make w install -m 2755 -g kmem -s w /usr/ucb cd /usr/ucb rm uptime ln w uptime Time for more refreshments! ;-) cd /usr/src/usr.lib/sendmail/src make make install make clean You will need to kill the currently running sendmail, refreeze the configuration file and restart sendmail: kill sendmail_pid /usr/lib/sendmail -bz /usr/lib/sendmail -bd -q1h (or whatever is in your /etc/rc) And lastly - the important items, the "man" pages. cd /usr/src/man/man3 /usr/man/manroff sysctl.3 > /usr/man/cat3/sysctl.0 /usr/man/manroff getloadavg.3 > /usr/man/cat3/getloadavg.0 chmod 444 /usr/man/cat3/sysctl.0 /usr/man/cat3/getloadavg.0 If you are the tidy type you will want to clean up by removing all the patch debris: find / -name '*~' -exec rm {} \; And that is all - you are done! Now it is time for experimentation with 'sysctl()'. You could read the man page (;-)) but for a good introduction to sysctl try: sysctl -a Cheers! Steven Schultz sms@wlv.iipo.gtegsc.com As always, these and previous updates to 2.11BSD are available via anonymous FTP to "ftp.iipo.gtegsc.com" in the directory /pub/2.11BSD. ==================cut here============== *** /usr/src/new/rn/intrp.c.old Fri Dec 31 22:48:18 1993 --- /usr/src/new/rn/intrp.c Sat Jan 21 18:17:07 1995 *************** *** 1,4 **** ! /* $Header: intrp.c,v 4.3.1.5 85/05/23 17:21:24 lwall Exp $ * * $Log: intrp.c,v $ * Revision 4.3.1.5 85/05/23 17:21:24 lwall --- 1,4 ---- ! /* $Header: intrp.c,v 4.3.1.5.1 95/01/21 17:21:24 lwall Exp $ * * $Log: intrp.c,v $ * Revision 4.3.1.5 85/05/23 17:21:24 lwall *************** *** 207,213 **** } tildedir = Nullch; tildename = savestr(scrbuf); - #ifdef GETPWENT /* getpwnam() is not the paragon of efficiency */ { struct passwd *getpwnam(); struct passwd *pwd = getpwnam(tildename); --- 207,212 ---- *************** *** 219,265 **** newsuid = atoi(pwd->pw_uid); #endif strcpy(filename,scrbuf); - #ifdef GETPWENT endpwent(); - #endif } - #else /* this will run faster, and is less D space */ - { /* just be sure LOGDIRFIELD is correct */ - FILE *pfp = fopen("/etc/passwd","r"); - char tmpbuf[512]; - int i; - - if (pfp == Nullfp) { - printf(cantopen,"passwd") FLUSH; - sig_catcher(0); - } - while (fgets(tmpbuf,512,pfp) != Nullch) { - d = cpytill(scrbuf,tmpbuf,':'); - #ifdef DEBUGGING - if (debug & DEB_FILEXP) - printf("p %s\n",tmpbuf) FLUSH; - #endif - if (strEQ(scrbuf,tildename)) { - #ifdef NEWSADMIN - if (strEQ(newsadmin,tildename)) - newsuid = atoi(index(d,':')+1); - #endif - for (i=LOGDIRFIELD-2; i; i--) { - if (d) - d = index(d+1,':'); - } - if (d) { - cpytill(scrbuf,d+1,':'); - tildedir = savestr(scrbuf); - strcat(scrbuf,s); - strcpy(filename,scrbuf); - } - break; - } - } - fclose(pfp); - } - #endif } #else !TILDENAME #ifdef VERBOSE --- 218,225 ---- *************** *** 1004,1027 **** char *s, *c; #ifdef PASSNAMES - #ifdef GETPWENT struct passwd *pwd = getpwuid(uid); s = pwd->pw_gecos; - #else - char tmpbuf[512]; - int i; - - getpw(uid, tmpbuf); - for (s=tmpbuf, i=GCOSFIELD-1; i; i--) { - if (s) - s = index(s,':')+1; - } - if (!s) - return nullstr; - cpytill(tmpbuf,s,':'); - s = tmpbuf; - #endif #ifdef BERKNAMES #ifdef BERKJUNK while (*s && !isalnum(*s) && *s != '&') s++; --- 964,972 ---- *************** *** 1045,1053 **** s = c; strcpy(buf,tmpbuf); #endif - #ifdef GETPWENT endpwent(); - #endif return buf; /* return something static */ #else if ((tmpfp=fopen(filexp(FULLNAMEFILE),"r")) != Nullfp) { --- 990,996 ---- *** /usr/src/usr.bin/refer/what1.c.old Mon Feb 16 16:21:00 1987 --- /usr/src/usr.bin/refer/what1.c Sat Jan 21 18:27:39 1995 *************** *** 1,8 **** ! #ifndef lint ! static char *sccsid = "@(#)what1.c 4.1 (Berkeley) 5/6/83"; #endif #include "what..c" struct filans files[NFILES]; char fnames[NAMES]; --- 1,9 ---- ! #if !defined(lint) && defined(DOSCCS) ! static char *sccsid = "@(#)what1.c 4.1.1 (2.11BSD GTE) 1/21/95"; #endif #include "what..c" + #include struct filans files[NFILES]; char fnames[NAMES]; *************** *** 87,100 **** int eval, k, pid; FILE *rf NULL; FILE *ans NULL; pid=getpid(); for(af=files; affdate); ! getpw(af->uid, s=buf); ! while (*s && *s!=':') s++; ! *s=0; printf("%s (%.20s) %s, %ld bytes\n",af->nm,t+4,buf,af->size); if (relfeed) { k=af-files; --- 88,106 ---- int eval, k, pid; FILE *rf NULL; FILE *ans NULL; + struct passwd *pw; + pid=getpid(); for(af=files; affdate); ! pw = getpwuid(af->uid); ! if (!pw) ! buf[0] = '\0'; ! else ! strcpy(buf, pw->pw_name); printf("%s (%.20s) %s, %ld bytes\n",af->nm,t+4,buf,af->size); + endpwent(); if (relfeed) { k=af-files; *** /usr/src/local/welcome/welcome.c.old Fri Dec 31 22:42:51 1993 --- /usr/src/local/welcome/welcome.c Fri Jan 20 23:19:40 1995 *************** *** 1,20 **** - #include #include ! #include "cpu.h" ! #include ! extern struct nlist namelist[]; ! extern struct nlist nl[]; - struct nlist nl[] = { { "_cpu" }, { "" } }; - double ldvec[4]; - int kmem; - - struct nlist namelist[] = { - { "_avenrun" }, - { 0 } - }; - char *days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; --- 1,10 ---- #include ! #include ! #include ! #include "./cpu.h" ! double ldvec[3]; char *days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; *************** *** 27,62 **** main() { register struct tm *det; ! int a, b, x, y, num, cpu; long secs; char bot[100], *foo, goo[50], ap; time(&secs); ! #ifdef LOAD ! #if defined(PDP) ! loadav(ldvec); ! #else defined(PDP) ! nlist("/vmunix", namelist); ! if (namelist[0].n_type == 1) ! puts("/vmunix no namelist\n"), exit(1); ! kmem = open("/dev/kmem", 0); ! if (kmem <= 0) ! printf("cannot open /dev/kmem\n"), exit(1); ! lseek(kmem, (long)namelist[0].n_value, 0); ! read(kmem, &ldvec[0], sizeof ldvec); ! close(kmem); ! #endif defined(PDP) ! #endif LOAD ! #ifdef CPU ! nlist("/vmunix", nl); ! if (nl[0].n_type == 1) ! puts("/vmunix no namelist\n"), exit(1); ! kmem = open("/dev/kmem", 0); ! if (kmem <= 0) ! printf("cannot open /dev/kmem\n"), exit(1); ! lseek(kmem, nl[0].n_value, 0); ! read(kmem, &cpu, sizeof(cpu)); ! close(kmem); ! #endif CPU ap = "AP"[(det = localtime(&secs))->tm_hour >= 12]; if (det->tm_hour > 0 && det->tm_hour < 12) foo = ttime[0]; --- 17,56 ---- main() { register struct tm *det; ! size_t size; ! int a, b, x, y, mib[2]; long secs; char bot[100], *foo, goo[50], ap; + char machine[64], model[64], ostype[64]; + time(&secs); ! (void)getloadavg(ldvec, 3); ! ! mib[0] = CTL_HW; ! mib[1] = HW_MACHINE; ! size = sizeof (machine); ! if (sysctl(mib, 2, machine, &size, NULL, 0) < 0) ! { ! printf("Can't get machine type\n"); ! strcpy(machine, "?"); ! } ! mib[0] = CTL_HW; ! mib[1] = HW_MODEL; ! size = sizeof (model); ! if (sysctl(mib, 2, model, &size, NULL, 0) < 0) ! { ! printf("Can't get cpu type\n"); ! strcpy(model, "?"); ! } ! mib[0] = CTL_KERN; ! mib[1] = KERN_OSTYPE; ! size = sizeof (ostype); ! if (sysctl(mib, 2, ostype, &size, NULL, 0) < 0) ! { ! printf("Can't get ostype\n"); ! strcpy(ostype, "?"); ! } ! ap = "AP"[(det = localtime(&secs))->tm_hour >= 12]; if (det->tm_hour > 0 && det->tm_hour < 12) foo = ttime[0]; *************** *** 68,74 **** det->tm_hour = 12; fflush(stdout); printf("\033[2J\033(0\033)0\033[m"); - #ifdef LOAD printf("\033[3;11H\033(B\033)B Load Average\033(0\033)0"); printf("\033[4;11Hlqqqqqqqqqqqqqqqqk"); printf("\033[5;11Hx x"); --- 62,67 ---- *************** *** 75,89 **** printf("\033[6;11Hmqqqqqqqqqqqqqqwqj"); printf("\033[5;13H%.02f %.02f %.02f", ldvec[0], ldvec[1], ldvec[2]); printf("\033[7;16Hlqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); - #else LOAD - printf("\033[7;16Hlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); - #endif LOAD #ifdef TTY printf("\033[3;51H\033(B\033)BTTY Name\033(0\033)0"); printf("\033[4;46Hlqqqqqqqqqqqqqqqqk"); printf("\033[5;46Hx x"); printf("\033[6;46Hmqwqqqqqqqqqqqqqqj"); ! printf("\033[5;50H\033(B\033)B%s\033(0\033)0",ttyname(isatty(ttyslot()))); printf("\033[7;16Hlqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqk"); #else TTY printf("\033[7;16Hlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); --- 68,79 ---- printf("\033[6;11Hmqqqqqqqqqqqqqqwqj"); printf("\033[5;13H%.02f %.02f %.02f", ldvec[0], ldvec[1], ldvec[2]); printf("\033[7;16Hlqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); #ifdef TTY printf("\033[3;51H\033(B\033)BTTY Name\033(0\033)0"); printf("\033[4;46Hlqqqqqqqqqqqqqqqqk"); printf("\033[5;46Hx x"); printf("\033[6;46Hmqwqqqqqqqqqqqqqqj"); ! printf("\033[5;50H\033(B\033)B%s\033(0\033)0",ttyname(0)); printf("\033[7;16Hlqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqk"); #else TTY printf("\033[7;16Hlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); *************** *** 111,194 **** #ifdef LIGHT printf("\033[13;13H\033[7m "); #endif LIGHT - #ifdef CPU printf("\033[m"); ! switch(cpu) { ! case VAX_780: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A VAX 11/780 running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A VAX 11/780 running Ultrix"); ! #endif LIGHT ! break; ! case VAX_750: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A VAX 11/750 running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A VAX 11/750 running Ultrix"); ! #endif LIGHT ! break; ! case VAX_730: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A VAX 11/730 running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A VAX 11/730 running Ultrix"); ! #endif LIGHT ! break; ! case VAX_8600: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A VAX 8600 running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A VAX 8600 running Ultrix"); ! #endif LIGHT ! break; ! case VAX_8200: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A VAX 8200 running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A VAX 8200 running Ultrix"); ! #endif LIGHT ! break; ! case VAX_8800: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A VAX 8800 running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A VAX 8800 running Ultrix"); ! #endif LIGHT ! break; ! case MVAX_I: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A MicroVAX I running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A MicroVAX I running Ultrix"); ! #endif LIGHT ! break; ! case MVAX_II: ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A MicroVAX II running Ultrix"); ! #else LIGHT ! printf("\033[13;13H A MicroVAX II running Ultrix"); ! #endif LIGHT ! break; ! default: ! printf("\033[13;13H CPU ident error"); ! break; ! } ! #else CPU ! #ifdef LIGHT ! #if defined(PDP) ! printf("\033[13;13H\033[7m A PDP-11 running 2.11BSD"); ! #else defined(PDP) ! printf("\033[13;13H\033[7m A system running Ultrix"); ! #endif defined(PDP) ! #else LIGHT ! #if defined(PDP) ! printf("\033[13;13H A PDP-11 running 2.11BSD"); ! #else defined(PDP) ! printf("\033[13;13H A system running Ultrix"); ! #endif defined(PDP) ! #endif LIGHT ! #endif CPU #ifdef UVERS fp = fopen("/etc/motd", "r"); fscanf(fp, "%s%s", poo, doo); --- 101,114 ---- #ifdef LIGHT printf("\033[13;13H\033[7m "); #endif LIGHT printf("\033[m"); ! #ifdef LIGHT ! printf("\033[13;13H\033[7m A %s/%s running %s", ! #else ! printf("\033[13;13H A %s/%s running %s", ! #endif ! machine, model, ostype); ! #ifdef UVERS fp = fopen("/etc/motd", "r"); fscanf(fp, "%s%s", poo, doo); *** /usr/src/local/welcome/cpu.h.old Mon Jan 16 22:39:57 1995 --- /usr/src/local/welcome/cpu.h Mon Jan 16 22:40:20 1995 *************** *** 3,24 **** char poo[100]; FILE *fp; - #define VAX_780 1 - #define VAX_750 2 - #define VAX_730 3 - #define VAX_8600 4 - #define VAX_8200 5 - #define VAX_8800 6 - #define MVAX_I 7 - #define MVAX_II 8 - /* System defines to be changed-- */ #define LOAD /* If you want the load average box, keep this defined. */ - /* #define CPU /* If you want to know what type CPU you are using, keep - this defined. NOTE: This option has only been tested for - Ultrix V2.0, nothing else. Please... Try it and mail - me back! */ /* #define UVERS /* If you want to know the version of Ultrix, keep this defined. This will work for any system with /etc/motd. #define LIGHT /* If you want the stuff inside the welcome box inversed, --- 3,11 ---- *** /usr/src/local/welcome/Makefile.old Fri Jan 22 21:43:44 1993 --- /usr/src/local/welcome/Makefile Mon Jan 16 22:40:36 1995 *************** *** 3,9 **** # DESTDIR= BINDIR= /usr/local ! CFLAGS= -O -DPDP SEPFLAG= -i PROGRAM= welcome SRCS= welcome.c --- 3,9 ---- # DESTDIR= BINDIR= /usr/local ! CFLAGS= -O SEPFLAG= -i PROGRAM= welcome SRCS= welcome.c *** /usr/src/games/warp/score.c.old Wed Aug 26 01:13:36 1987 --- /usr/src/games/warp/score.c Sat Jan 21 18:09:41 1995 *************** *** 1,4 **** ! /* $Header: /usr/src/games/warp/RCS/score.c,v 1.1 87/07/03 02:13:26 games Exp $ */ /* $Log: score.c,v $ * Revision 7.0.1.2a 87/07/03 02:13:26 games --- 1,4 ---- ! /* $Header: /usr/src/games/warp/RCS/score.c,v 1.1.1 95/01/21 02:13:26 games Exp $ */ /* $Log: score.c,v $ * Revision 7.0.1.2a 87/07/03 02:13:26 games *************** *** 40,53 **** finalize(1); } if (filestat.st_uid != geteuid()) { - #ifdef GETPWENT printf("Warp will not run right without being setuid.\r\n"); - #else - getpw(filestat.st_uid, spbuf); - s = index(spbuf, ':'); - *s = '\0'; - printf("Warp will not run right without being setuid to %s.\r\n",spbuf); - #endif finalize(1); } if ((filestat.st_mode & 0605) != 0605) { --- 40,46 ---- *** /usr/src/games/warp/intrp.c.old Sat Jan 1 00:56:44 1994 --- /usr/src/games/warp/intrp.c Sat Jan 21 18:12:36 1995 *************** *** 1,4 **** ! /* $Header: /usr/src/games/warp/RCS/intrp.c,v 1.3 93/12/31 22:40:37 games Exp $ * * $Log: intrp.c,v $ * Revision 7.0.2 93/12/31 23:40:37 games --- 1,4 ---- ! /* $Header: /usr/src/games/warp/RCS/intrp.c,v 1.3.1 95/1/21 22:40:37 games Exp $ * * $Log: intrp.c,v $ * Revision 7.0.2 93/12/31 23:40:37 games *************** *** 613,636 **** char *s, *c; #ifdef PASSNAMES - #ifdef GETPWENT struct passwd *pwd = getpwuid(uid); s = pwd->pw_gecos; - #else - char tmpbuf[512]; - int i; - - getpw(uid, tmpbuf); - for (s=tmpbuf, i=GCOSFIELD-1; i; i--) { - if (s) - s = index(s,':')+1; - } - if (!s) - return nullstr; - Cpytill(tmpbuf,s,':'); - s = tmpbuf; - #endif #ifdef BERKNAMES #ifdef BERKJUNK while (*s && !isalnum(*s) && *s != '&') s++; --- 613,621 ---- *************** *** 654,662 **** s = c; strcpy(buf,tmpbuf); #endif - #ifdef GETPWENT endpwent(); - #endif return buf; /* return something static */ #else if ((tmpfp=fopen(filexp(FULLNAMEFILE),"r")) != Nullfp) { --- 639,645 ---- *** /usr/src/games/warp/warp.h.old Fri Jun 19 10:08:10 1987 --- /usr/src/games/warp/warp.h Sat Jan 21 19:39:31 1995 *************** *** 1,6 **** ! /* $Header: warp.h,v 7.0.1.2 86/12/12 17:08:42 lwall Exp $ */ /* $Log: warp.h,v $ * Revision 7.0.1.2 86/12/12 17:08:42 lwall * Baseline for net release. * --- 1,9 ---- ! /* $Header: warp.h,v 7.0.1.3 95/21/1 17:08:42 lwall Exp $ */ /* $Log: warp.h,v $ + * Revision 7.0.1.3 95/21/1 18:40:00 sms + * Remove ifdefs around pwd.h + * * Revision 7.0.1.2 86/12/12 17:08:42 lwall * Baseline for net release. * *************** *** 116,124 **** #include #endif - #ifdef GETPWENT # include - #endif #define BITSPERBYTE 8 #define LBUFLEN 512 /* line buffer length */ --- 119,125 ---- *** /usr/src/games/mille/mille.c.old Sat Jan 11 11:47:31 1986 --- /usr/src/games/mille/mille.c Mon Jan 16 23:07:46 1995 *************** *** 5,11 **** # endif attron /* ! * @(#)mille.c 1.3 (Berkeley) 5/10/83 */ int rub(); --- 5,11 ---- # endif attron /* ! * @(#)mille.c 1.3.1 (2.11BSD GTE) 1/16/95 */ int rub(); *************** *** 25,40 **** Debug = TRUE; } restore = FALSE; ! # ifdef LOADAV ! if (geteuid() != ARNOLD) { ! loadav(avs); ! if (avs[2] > 9.0) { ! printf("Sorry. The load average is too high.\n"); ! printf("Please try again later\n"); ! exit(1); ! } } ! # endif switch (ac) { case 2: rest_f(av[1]); --- 25,38 ---- Debug = TRUE; } restore = FALSE; ! ! getloadavg(avs, 3); ! if (avs[2] > 4.0) { ! printf("Sorry. The load average is too high.\n"); ! printf("Please try again later\n"); ! exit(1); } ! switch (ac) { case 2: rest_f(av[1]); *** /usr/src/games/snake/busy.c.old Thu Jan 6 21:25:25 1994 --- /usr/src/games/snake/busy.c Mon Jan 16 23:17:17 1995 *************** *** 5,11 **** */ #if defined(DOSCCS) && !defined(lint) ! static char sccsid[] = "@(#)busy.c 5.1.1 (2.11BSD GTE) 1/06/93"; #endif /* --- 5,11 ---- */ #if defined(DOSCCS) && !defined(lint) ! static char sccsid[] = "@(#)busy.c 5.1.2 (2.11BSD GTE) 1/16/95"; #endif /* *************** *** 22,28 **** double la[3]; double max; ! loadav(la); max = la[0]; if (la[1] > max) max = la[1]; if (la[2] > max) max = la[2]; --- 22,28 ---- double la[3]; double max; ! getloadavg(la, 3); max = la[0]; if (la[1] > max) max = la[1]; if (la[2] > max) max = la[2]; *************** *** 33,63 **** else printf("0\n"); exit(0); - } - - #include - - struct nlist nl[] = { - { "_avenrun" }, - { 0 }, - }; - - loadav(avenrun) - double *avenrun; - { - register int i; - int kmem; - - if ((kmem = open("/dev/kmem", 0)) < 0) { - fprintf(stderr, "No kmem\n"); - exit(1); - } - nlist("/vmunix", nl); - if (nl[0].n_type==0) { - fprintf(stderr, "No namelist\n"); - exit(1); - } - - lseek(kmem, (long)nl[0].n_value, 0); - read(kmem, avenrun, 3*sizeof(*avenrun)); } --- 33,36 ---- *** /usr/src/games/snake/Makefile.old Wed Feb 25 19:25:26 1987 --- /usr/src/games/snake/Makefile Mon Jan 16 23:30:44 1995 *************** *** 3,17 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.1 (Berkeley) 5/30/85 # DESTDIR= ! CFLAGS= -O LIBS= -lm -ltermcap BIN= $(DESTDIR)/usr/games LIB= $(DESTDIR)/usr/games/lib USER= daemon ! UTILS= snscore OBJS= snake.o move.o ALL= snake ${UTILS} SEPFLAG= -i --- 3,17 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.1.1 (2.11BSD GTE) 1/16/95 # DESTDIR= ! CFLAGS= -O -DCHECKBUSY LIBS= -lm -ltermcap BIN= $(DESTDIR)/usr/games LIB= $(DESTDIR)/usr/games/lib USER= daemon ! UTILS= snscore busy OBJS= snake.o move.o ALL= snake ${UTILS} SEPFLAG= -i *************** *** 32,38 **** install: all install -s -m 4755 -o ${USER} snake ${BIN}/snake install -s -m 755 -o ${USER} snscore ${BIN}/snscore ! # install -s -m 755 -o ${USER} busy ${BIN}/busy cat /dev/null >> $(LIB)/snakerawscores chmod 644 $(LIB)/snakerawscores chown $(USER) $(LIB)/snakerawscores --- 32,38 ---- install: all install -s -m 4755 -o ${USER} snake ${BIN}/snake install -s -m 755 -o ${USER} snscore ${BIN}/snscore ! install -s -m 755 -o ${USER} busy ${LIB}/busy cat /dev/null >> $(LIB)/snakerawscores chmod 644 $(LIB)/snakerawscores chown $(USER) $(LIB)/snakerawscores *** /usr/src/games/canfield.c.old Mon Jan 10 21:58:04 1994 --- /usr/src/games/canfield.c Mon Jan 16 23:03:26 1995 *************** *** 9,15 **** "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)canfield.c 5.4.1 (2.11BSD GTE) 1/1/94"; #endif /* --- 9,15 ---- "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)canfield.c 5.4.2 (2.11BSD GTE) 1/16/95"; #endif /* *************** *** 1604,1610 **** #ifdef MAXLOAD double vec[3]; ! loadav(vec); if (vec[2] >= MAXLOAD) { puts("The system load is too high. Try again later."); exit(0); --- 1604,1610 ---- #ifdef MAXLOAD double vec[3]; ! getloadavg(vec, 3); if (vec[2] >= MAXLOAD) { puts("The system load is too high. Try again later."); exit(0); *** /usr/src/usr.lib/lpr/filters/rotate.c.old Wed Feb 18 01:10:39 1987 --- /usr/src/usr.lib/lpr/filters/rotate.c Sat Jan 21 17:49:09 1995 *************** *** 4,11 **** * specifies the terms and conditions for redistribution. */ ! #ifndef lint ! static char sccsid[] = "@(#)rotate.c 5.1 (Berkeley) 5/15/85"; #endif not lint /* --- 4,11 ---- * specifies the terms and conditions for redistribution. */ ! #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)rotate.c 5.1.1 (2.11BSD GTE) 1/21/95"; #endif not lint /* *************** *** 26,32 **** struct header h; struct dispatch d[256], nd; struct stat stb; ! off_t tell(); int i,size; int beg; char scr[2048]; --- 26,32 ---- struct header h; struct dispatch d[256], nd; struct stat stb; ! off_t lseek(); int i,size; int beg; char scr[2048]; *************** *** 50,62 **** exit(1); } fstat(0, &stb); ! size = stb.st_size - tell(0); fprintf(stderr, "%d bytes of characters\n", size); chp = sbrk(size + 1024); read(0, chp, size); write(1, &h, sizeof (h)); write(1, d, sizeof (d)); ! beg = tell(1); for (i = 0; i < 256; i++) if (d[i].nbytes) { if (d[i].addr + d[i].nbytes > size) { --- 50,62 ---- exit(1); } fstat(0, &stb); ! size = stb.st_size - lseek(0, 0L, 1); fprintf(stderr, "%d bytes of characters\n", size); chp = sbrk(size + 1024); read(0, chp, size); write(1, &h, sizeof (h)); write(1, d, sizeof (d)); ! beg = lseek(1, 0L, 1); for (i = 0; i < 256; i++) if (d[i].nbytes) { if (d[i].addr + d[i].nbytes > size) { *************** *** 65,76 **** } cvt(&d[i], chp+d[i].addr, &nd, scr); d[i] = nd; ! d[i].addr = tell(1) - beg; write(1, scr, d[i].nbytes); } ! fprintf(stderr, "done, new size %d\n", tell(1) - beg); ! h.size = tell(1) - beg; ! lseek(1, 0, 0); write(1, &h, sizeof (h)); write(1, d, sizeof (d)); } --- 65,76 ---- } cvt(&d[i], chp+d[i].addr, &nd, scr); d[i] = nd; ! d[i].addr = lseek(1, 0L, 1) - beg; write(1, scr, d[i].nbytes); } ! fprintf(stderr, "done, new size %d\n", lseek(1, 0L, 1) - beg); ! h.size = lseek(1, 0L, 1) - beg; ! lseek(1, 0L, 0); write(1, &h, sizeof (h)); write(1, d, sizeof (d)); } *** /usr/src/usr.lib/lpr/filters/rotprt.c.old Wed Feb 18 01:10:39 1987 --- /usr/src/usr.lib/lpr/filters/rotprt.c Sat Jan 21 17:50:25 1995 *************** *** 4,11 **** * specifies the terms and conditions for redistribution. */ ! #ifndef lint ! static char sccsid[] = "@(#)rotprt.c 5.1 (Berkeley) 5/15/85"; #endif not lint /* --- 4,11 ---- * specifies the terms and conditions for redistribution. */ ! #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)rotprt.c 5.1.1 (2.11BSD GTE) 1/21/95"; #endif not lint /* *************** *** 26,32 **** struct header h; struct dispatch d[256]; struct stat stb; ! off_t tell(); int i,size; argc--, argv++; --- 26,32 ---- struct header h; struct dispatch d[256]; struct stat stb; ! off_t lseek(); int i,size; argc--, argv++; *************** *** 42,48 **** if (read(0, d, sizeof(d)) != sizeof(d)) fprintf(stderr, "dispatch read error\n"), exit(1); fstat(0, &stb); ! size = stb.st_size - tell(0); fprintf(stderr, "%d bytes of characters\n", size); chp = sbrk(size); read(0, chp, size); --- 42,48 ---- if (read(0, d, sizeof(d)) != sizeof(d)) fprintf(stderr, "dispatch read error\n"), exit(1); fstat(0, &stb); ! size = stb.st_size - lseek(0, 0L, 1); fprintf(stderr, "%d bytes of characters\n", size); chp = sbrk(size); read(0, chp, size); *** /usr/src/usr.lib/sendmail.MX/src/conf.c.old Sat Jan 1 01:11:03 1994 --- /usr/src/usr.lib/sendmail.MX/src/conf.c Wed Jan 18 20:07:55 1995 *************** *** 15,21 **** */ #if !defined(lint) && !defined(NOSCCS) ! static char sccsid[] = "@(#)conf.c 5.16.1 (2.11BSD) 1/1/94"; #endif /* not lint */ # include --- 15,21 ---- */ #if !defined(lint) && !defined(NOSCCS) ! static char sccsid[] = "@(#)conf.c 5.16.2 (2.11BSD) 1/18/95"; #endif /* not lint */ # include *************** *** 388,457 **** ** none. */ - #ifdef VMUNIX - #ifdef pdp11 - getla() { ! double avenrun[3]; ! loadav(avenrun); ! return(avenrun[0]); } - - #else !pdp11 - - #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)) < 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? ** --- 388,400 ---- ** none. */ getla() { ! double avenrun; ! getloadavg(&avenrun, 1); ! return(avenrun); } /* ** SHOULDQUEUE -- should this message be queued or sent? ** *** /VERSION.old Wed Jan 18 19:46:24 1995 --- /VERSION Sat Jan 21 22:23:48 1995 *************** *** 1,4 **** ! Current Patch Level: 218 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 223 2.11 BSD ============