Subject: libvmf,cpp,rauboot,mkstr(1) fixes, ld feature (#441) Index: usr.lib/libvmf,lib/cpp,sys/mdec/rauboot.s,... 2.11BSD Description: 1. The libvmf (virtual memory using tmp files) routines could crash or hang an application if too many locked segments were requested. 2. The C preprocessor (cpp) had a memory leak which could cause it to run out of memory _and_ also failed to check the return status of calloc() which would cause cpp to fail ungracefully. 3. The MSCP bootblock would not work with a CMD CQD220 adaptor due to the bootblock relying on the (undocumented?) behaviour of DEC adaptors. 4. In the mkstr(1) manpage the usage example given used lseek(2) incorrectly. 5. The linker (ld) does not accept the '-g' flag which on other systems says to retain debuggin symbols. 6. creat() is no longer a system call, thus it is an error to have creat(2) instead of creat(3). Repeat-By: Observation. Alternatively have Anders Magnusson beating on the system and submitting bug reports on a regular basis :-) The change to ld(1) is for compatibility for the same reason that '-z' was added a long time ago. Eventually perhaps extra debug information will be generated by the compilers. Fix: The following files are removed/added/modified by this update: added: /usr/src/man/man3/creat.3 removed: /usr/man/cat2/creat.0 removed: /usr/src/man/man2/creat.2 modified: /usr/src/usr.lib/libvmf/vmf.c.old modified: /usr/src/sys/mdec/rauboot.s.old modified: /usr/src/bin/ld/ld.c.old modified: /usr/src/lib/cpp/cpp.c.old modified: /usr/src/lib/cpp/Makefile.old modified: /usr/src/man/man1/mkstr.1.old modified: /usr/src/man/man2/Makefile.old modified: /usr/src/man/man3/Makefile.old modified: /VERSION.old The file attached below is a shar file containing: 441.sh - a script to remove the two manpages 441.shar - a shar file to add the new manpage 441.patch - a patch file to modify the remaining files To apply this update cut where indicated and save to a file (/tmp/441). Then: cd /tmp sh 441 ./441.sh sh 441.shar patch -p0 < 441.patch cd /usr/src/usr.lib/libvmf make make install make clean cd /usr/src/lib/cpp make make install make clean cd /usr/src/bin/ld make make install make clean cd /usr/src/man/man1 /usr/man/manroff mkstr.1 > /usr/man/cat1/mkstr.0 cd ../man3 /usr/man/manroff creat.3 > /usr/man/cat3/creat.0 cd /sys/mdec make make install make clean And with that you're done. As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.TO.GD-ES.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: # 441.sh # 441.shar # 441.patch # This archive created: Tue Dec 4 20:22:11 2001 export PATH; PATH=/bin:/usr/bin:$PATH if test -f '441.sh' then echo shar: "will not over-write existing file '441.sh'" else sed 's/^Y//' << \SHAR_EOF > '441.sh' Y#!/bin/sh Y Yrm -f /usr/man/cat2/creat.0 Yrm -f /usr/src/man/man2/creat.2 SHAR_EOF chmod 755 '441.sh' fi if test -f '441.shar' then echo shar: "will not over-write existing file '441.shar'" else sed 's/^Y//' << \SHAR_EOF > '441.shar' Y#! /bin/sh Y# This is a shell archive, meaning: Y# 1. Remove everything above the #! /bin/sh line. Y# 2. Save the resulting text in a file. Y# 3. Execute the file with /bin/sh (not csh) to create: Y# /usr/src/man/man3/creat.3 Y# This archive created: Tue Dec 4 19:51:12 2001 Yexport PATH; PATH=/bin:/usr/bin:$PATH Yif test -f '/usr/src/man/man3/creat.3' Ythen Y echo shar: "will not over-write existing file '/usr/src/man/man3/creat.3'" Yelse Ycat << \SHAR_EOF > '/usr/src/man/man3/creat.3' Y.\" Copyright (c) 1980 Regents of the University of California. Y.\" All rights reserved. The Berkeley software License Agreement Y.\" specifies the terms and conditions for redistribution. Y.\" Y.\" @(#)creat.2 6.7 (2.11BSD) 2001/11/19 Y.\" Y.TH CREAT 3 "November 19, 2001" Y.UC 4 Y.SH NAME Ycreat \- create a new file Y.SH SYNOPSIS Y.nf Y.ft B Y#include Y#include Y Ycreat(name, mode) Y char *name; Y int mode; Y.ft R Y.fi Y.SH DESCRIPTION Y\fBThis interface is made obsolete by:\fP open(2). Y.PP Y.BR Creat () Yis the same as: Y.nf Y Y open(name, O_CREAT | O_TRUNC | O_WRONLY, mode); Y.fi Y.SH "SEE ALSO" Yopen(2) Y.SH "HISTORY" YThe \fBcreat\fP function call appeared in Version 6 AT&T UNIX. YSHAR_EOF Yfi Yexit 0 Y# End of shell archive SHAR_EOF chmod 644 '441.shar' fi if test -f '441.patch' then echo shar: "will not over-write existing file '441.patch'" else sed 's/^Y//' << \SHAR_EOF > '441.patch' Y*** /usr/src/usr.lib/libvmf/vmf.c.old Thu Oct 21 20:55:38 1993 Y--- /usr/src/usr.lib/libvmf/vmf.c Mon Nov 19 19:43:14 2001 Y*************** Y*** 93,100 **** Y Y nmapsegs++; Y Y! if (segno >= vspace->v_maxsegno || segno < 0) Y! { Y #ifdef DEBUG Y fprintf(stderr,"vmmapseg vspace0%o segno%d\n", vspace, segno); Y #endif Y--- 93,99 ---- Y Y nmapsegs++; Y Y! if (segno >= vspace->v_maxsegno) { Y #ifdef DEBUG Y fprintf(stderr,"vmmapseg vspace0%o segno%d\n", vspace, segno); Y #endif Y*************** Y*** 110,122 **** Y { /* not in memory */ Y int status; Y Y! for (s = (struct vseg *)s->s_link.back; s->s_lock_count != 0; Y! s = (struct vseg *)s->s_link.back) Y! { Y! if (s == (struct vseg *)seghead) Y! vmerror("Too many locked segs!"); Y debugseg(s, "back skip"); Y! } Y debugseg(s, "dump on"); Y if (s->s_flags & S_DIRTY) Y if (swap(s, write) != 0) Y--- 109,120 ---- Y { /* not in memory */ Y int status; Y Y! for (s = (struct vseg *)s->s_link.back; Y! s !=(struct vseg *)seghead && s->s_lock_count != 0; Y! s = (struct vseg *)s->s_link.back) Y debugseg(s, "back skip"); Y! if (s == (struct vseg *)seghead) Y! vmerror("Too many locked segs!"); Y debugseg(s, "dump on"); Y if (s->s_flags & S_DIRTY) Y if (swap(s, write) != 0) Y*** /usr/src/sys/mdec/rauboot.s.old Wed May 17 19:54:13 2000 Y--- /usr/src/sys/mdec/rauboot.s Mon Nov 19 20:02:57 2001 Y*************** Y*** 16,22 **** Y Y MSCPSIZE = 64. / One MSCP command packet is 64bytes long (need 2) Y Y! RASEMAP = 140000 / RA controller owner semaphore Y Y RAERR = 100000 / error bit Y RASTEP1 = 04000 / step1 has started Y--- 16,22 ---- Y Y MSCPSIZE = 64. / One MSCP command packet is 64bytes long (need 2) Y Y! RASEMAP = 100000 / RA controller owner semaphore Y Y RAERR = 100000 / error bit Y RASTEP1 = 04000 / step1 has started Y*************** Y*** 287,309 **** Y mov $RASEMAP,*$ra+RARSPH / set mscp semaphores Y mov $RASEMAP,*$ra+RACMDH Y mov *raip,r0 / tap controllers shoulder Y! mov $ra+RACMDI,r0 Y 1: Y tst (r0) Y! beq 1b / Wait till command read Y! clr (r0)+ / Tell controller we saw it, ok. Y 2: Y tst (r0) Y! beq 2b / Wait till response written Y clr (r0) / Tell controller we go it Y rts pc Y Y! / Some adaptors (TD Systems Viking for example) require the vector field Y! / to be initialized even though interrupts are not enabled. Use the primary Y! / vector of 0154. The standalone MSCP driver does the same thing and later on Y! / the kernel programs the adaptor with an assigned vector Y! Y! icons: RAERR + 033 / 033 = 0154 >> 2 Y ra+RARING Y 0 Y RAGO Y--- 287,306 ---- Y mov $RASEMAP,*$ra+RARSPH / set mscp semaphores Y mov $RASEMAP,*$ra+RACMDH Y mov *raip,r0 / tap controllers shoulder Y! mov $ra+RACMDH,r0 Y 1: Y tst (r0) Y! bmi 1b / Wait till command read Y! mov $ra+RARSPH,r0 Y 2: Y tst (r0) Y! bmi 2b / Wait till response written Y! mov $ra+RACMDI,r0 Y! clr (r0)+ / Tell controller we saw it, ok. Y clr (r0) / Tell controller we go it Y rts pc Y Y! icons: RAERR + 033 Y ra+RARING Y 0 Y RAGO Y*** /usr/src/bin/ld/ld.c.old Mon Nov 19 19:41:48 2001 Y--- /usr/src/bin/ld/ld.c Mon Nov 19 19:42:29 2001 Y*************** Y*** 478,483 **** Y--- 478,485 ---- Y } Y curov++; Y continue; Y+ case 'g': /* Just ignore the debug flag */ Y+ continue; Y case 'y': Y case 'A': Y case 'H': Y*** /usr/src/lib/cpp/cpp.c.old Sun Aug 26 09:36:03 2001 Y--- /usr/src/lib/cpp/cpp.c Mon Nov 19 19:49:46 2001 Y*************** Y*** 148,153 **** Y--- 148,154 ---- Y STATIC char *dirnams[MAXINC]; /* actual directory of #include files */ Y STATIC int fins[MAXINC]; Y STATIC int lineno[MAXINC]; Y+ STATIC char *lowmem; /* set to lowest address that malloc uses */ Y Y STATIC char *dirs[10]; /* -I and <> directories */ Y char *strdex(), *copy(), *subst(), *trmdir(); Y*************** Y*** 804,809 **** Y--- 805,812 ---- Y cp2 = cp; Y while (*cp2 != '"' && cp2 < inp) Y cp2++; Y+ if (fnames[ifno] >= lowmem) Y+ free(fnames[ifno]); Y fnames[ifno] = savestring(cp, cp2); Y } Y continue; Y*************** Y*** 823,828 **** Y--- 826,833 ---- Y register char *cp; Y Y retbuf = (char *) calloc(finish - start + 1, sizeof (char)); Y+ if (retbuf == NULL) Y+ pperror("calloc"); Y cp = retbuf; Y while (start < finish) Y *cp++ = *start++; Y*************** Y*** 1088,1093 **** Y--- 1093,1100 ---- Y fnames[ifno=0] = (char *)inquire(stdin, _FILENAME); Y dirnams[0] = dirs[0] = trmdir(copy(fnames[0])); Y # endif Y+ lowmem = (char *)sbrk(0); /* for free() */ Y+ Y for(i=1; i