ChangestotheKernelin4.2BSD July25,1983 SamuelJ.Leffler ComputerSystemsResearchGroup DepartmentofElectricalEngineeringandComputerScience UniversityofCalifornia,Berkeley Berkeley,California94720 (415)642-7780 ThisdocumentsummarizesthechangestothekernelbetweentheSeptember19814.1BSD releaseandtheJuly19834.2BSDdistribution.Theinformationispresentedinbothoverallterms (e.g.organizationalchanges),andasspecificcommentsaboutindividualfiles.Seethesourcecode itselfformoredetails. Thesystemhasundergonetoomanychangestodetaileverything.Insteadthemajorareas ofchangewillpointedout,followedbyabriefdescriptionofthecontentsoffilespresentinthe 4.1BSDrelease.Whereimportantchangesand/orbugfixeswereappliedtheyaredescribed.The networkingsupportisnotdiscussedinthisdocument,referto‘‘4.2BSDNetworkingImplementationNotes’’foradiscussionoftheinternalstructureofthenetworkfacilities. Majorchangesinclude: •organizationalchangestoisolateVAXspecificportionsofthesystem •changestosupportthenewfilesystemorganization •changestosupportthenewinterprocesscommunicationfacilities •changesforthenewnetworkingsupport;inparticular,theDARPAstandardInternetprotocols TCP,UDP,IP,andICMP,andthenetworkinterfacedriverswhichprovidehardwaresupport •changesforthenewsignalfacilities •changesforthenewtimeandintervaltimerfacilities •changestoeliminatereferencestoglobalvariables;inparticular,theglobalvariablesu.ubase, u.uoffset,u.usegflg,andu.ucounthavebeenalmostcompletelyreplacedbyuiostructures whicharepassedbyreference;theu.uerrorvariablehasnotbeencompletelypurgedfromlow levelportionsofthesystem,butisinmanyplacesnowreturnedasafunctionvalue;theuio changeswerenecessitatedbythenewscatter-gatheri/ofacilities •changesforthenewdiskquotafacilities •changesformoreflexibleconfigurationofthediskspaceusedforpagingandswapping 1.Carryingoverlocalsoftware Withthemassivechangesmadetothesystem,bothinorganizationandincontent,itmay takesometimetounderstandhowtocarryoverlocalsoftware.Themajorityofthisdocumentis devotedtodescribingthecontentsofeachimportantsourcefileinthesystem.Ifyouhavelocal softwareotherthandevicedriverstoincorporateinthesystemyoushouldfirstreadthisdocumentcompletely,thenstudythesourcecodetomorefullyunderstandthechangesastheyaffect you. Locallywrittendevicedriverswillneedtobeconvertedtoworkinthenewsystem.The changesrequiredofdevicedriversare:

-2-1)Thecallingconventionforthedriverioctlroutinehaschanged.Anydatacopiedinoroutof thesystemisnowdoneatthehighestlevelinsideioctl().Thethirdparametertothedriver ioctlroutineisadatabufferpassedbyreference.Valuestobereturnedbyadrivermustbe copiedintotheassociatedbufferfromwhichthesystemthencopiesthemintotheuser addressspace. 2)Theread,write,andioctlentrypointsindevicedriversmustreturn0oranerrorcodefrom <errno.h>. 3)Thereadandwriteentrypointsshouldnolongerreferenceglobalvariablesoutoftheuser area.Anewuioparameterispassedtotheseroutineswhichshould,inturn,bepassedto thephysio()routineifthedriversupportsrawi/o. 4)Diskdriverswhicharetosupportswapping/pagingmusthaveanewroutinewhichreturns thesize,insectors,ofadiskpartition.Thisvalueisusedincalculatingthesizeofswapping/pagingareasatboottime. 5)Codewhichpreviouslyusedtheiomove,passc,orcpassroutineswillhavetobemodifiedto usethenewuiomove,ureadc,anduwritecroutines.Thenewroutinesalluseauiostructure tocommunicatethei/obase,offset,count,andsegflagvaluespreviouslypassedgloballyin theuserarea. 6)Includefileshavebeenrearrangedandnewoneshavebeencreated.Commonmachinedependentfilessuchasmtpr.h,pte.h,reg.h,andpsl.harenolongerinthe‘‘h’’directory;see belowunderorganizationalchanges. 7)ThehandlingofUNIBUSresetshaschanged.Theresetroutineshouldnolongerdeallocate UNIBUSresourcesallocatedtopendingi/orequests(thisisdoneintheubaresetroutine). Formostdriversthismeanstheresetroutinesimplyneedstoinvalidateanyubinfovalues storedinlocaldatastructurestoinsurenewUNIBUSresourceswillbeallocatedthenext timethe‘‘devicestart’’routineisentered. 2.Organizationalchanges Thedirectoryorganizationandfilenamesareverydifferentfrom4.1BSD.Thenewdirectorylayoutbreaksmachine-specificandnetwork-specificportionsofthesystemoutintoseparate directories.Anewfile,machineisasymboliclinktoadirectoryforthetargetmachine,e.g.vax. Thisallowsasinglesetofsourcestobesharedbetweenmultiplemachinetypes(byincluding headerfilesas‘‘../machine/file’’).Thedirectorynamingconventions,astheyrelatetothenetworksupport,areintendedtoallowexpansioninsupportingmultiple‘‘protocolfamilies’’.The followingdirectoriescomprisethesystemsourcesfortheVAX: /sys/hmachineindependentincludefiles /sys/sysmachineindependentsystemsourcefiles /sys/confsiteconfigurationfilesandbasictemplates /sys/netnetworkindependent,butnetworkrelatedcode /sys/netinetDARPAInternetcode /sys/netimpIMPsupportcode /sys/netpupPUP-1supportcode /sys/vaxVAXspecificmainlinecode /sys/vaxifVAXnetworkinterfacecode /sys/vaxmbaVAXMASSBUSdevicedriversandrelatedcode /sys/vaxubaVAXUNIBUSdevicedriversandrelatedcode Filesindicatedasmachineindependentaresharedamong4.2BSDsystemsrunningonthe VAXandMotorola68010.Filesindicatedasmachinedependentarelocatedindirectoriesindicativeofthemachineonwhichtheyareused;the4.2BSDreleasefromBerkeleycontainssupport onlyfortheVAX.Filesmarkednetworkindependentformthe‘‘core’’ofthenetworkingsubsystem,andaresharedamongallnetworksoftware;the4.2BSDreleasefromBerkeleycontains -3-completesupportonlyfortheDARPAInternetprotocolsIP,TCP,UDP,andICMP. 3.Bugfixesandchanges Thissectioncontainsabriefdescriptionofeachfilewhichisnotpartofthenetworksubsystem,andalsoindicatesimportantchangesandbugfixesappliedtothesourcecodecontainedin thefile. 3.1./sys/h Filesresidinghereareintendedtobemachineindependent.Consequently,theheaderfiles fordevicedriverswhichwerepresentinthisdirectoryin4.1BSDhavebeenmovedtootherdirectories;e.g./sys/vaxuba.Manyfileswhichhadbeenduplicatedin/usr/includearenowpresent onlyin/sys/h.Further,the4.1BSD/usr/include/sysdirectoryisnownormallyasymboliclink tothisdirectory.Byhavingonlyasinglecopyofthesefilesthe‘‘multipleupdate’’problemno longeroccurs.(Itisstillpossibletohave/usr/include/sysbeacopyofthe/sys/hforsiteswhere itisnotfeasibletoallowthegeneralusercommunityaccesstothesystemsourcecode.) Thefollowingfilesarenewto/sys/hin4.2BSD: domain.hdescribestheinternalstructureofacommunicationsdomain;partofthenewipc facilities errno.hhadpreviouslybeenonlyin/usr/include;thefile/usr/include/errno.hisnowa symboliclinktothisfile fs.hreplacestheoldfilsys.hdescriptionofthefilesystemorganization gprof.hdescribesvariousdatastructuresusedinprofilingthekernel;seegprof(1)for details kernel.hisanoffshootofsystm.handparam.h;containsconstantsanddefinitionsrelated tothelogicalUNIX‘‘kernel’’ mbuf.hdescribesthememorymanagmentsupportusedmostlybythenetwork;see ‘‘4.2BSDNetworkingImplementationNotes’’formoreinformation mman.hcontainsdefinitionsforplannedchangestothememorymanagementfacilities (notimplementedin4.2BSD) nami.hdefinesvariousstructuresandmanifestconstantsusedinconjunctionswiththe nameiroutine(partofthisfilereflectsfutureplansforchangestonameirather thancurrentuse) protosw.hcontainsadescriptionoftheprotocolswitchtableandrelatedmanifestconstants anddatastructuresuseincommunicatingwithroutineslocatedinthetable quota.hcontainsdefinitionsrelatedtothenewdiskquotafacilities resource.hcontainsdefinitionsusedinthegetrusage,getrlimit,andgetprioritysystemcalls (amongothers) socket.hcontainsuser-visibledefinitionsrelatedtothenewsocketipcfacilities socketvar.hcontainsimplementationdefinitionsforthesocketipcfacilities ttychars.hcontainsdefinitionsrelatedtottycharacterhandling;inparticular,manifestconstantsforthesystemstandarderase,kill,interrupt,quit,etc.charactersare storedhere(alltheappropriateuserprogramsusethesemanifestdefinitions) ttydev.hcontainsdefinitionsrelatedtohardwarespecificportionsofttyhandling(suchas baudrates);tobeexpandedinthefuture uio.hcontainsdefinitionsforuserswishingtousethenewscatter-gatheri/ofacilities; alsocontainsthekerneluiostructureusedinimplementingscatter-gatheri/o un.hcontainsuser-visibledefinitionsrelatedtothe‘‘unix’’ipcdomain -4-unpcb.hcontainsthedefinitionoftheprotocolcontrolblockusedinthe‘‘unix’’ipc domain wait.hcontainsdefinitionsusedinthewaitandwait3(2)systemcalls;previouslyin /usr/include/wait.h Thefollowingfileshaveundergonesignificantchange: buf.hreflectsthechangesmadetothebuffercacheforthenewfilesystemorganization −buffersarevariablesizedwithpagesallocatedtobuffersondemandfroma poolofpagesdedicatedtothebuffercache;onenewstructurememberhasbeen addedtoeliminateoverloadingofacommonlyunreferencedstructuremember;a newflagBCALL,whenset,causesthefunctionbiodonetobecalledwheni/o completesonabuffer(thisisusedtowakeupthepageoutdaemon);macroshave beenaddedformanipulatingthebufferqueues,thesereplacetheprevioussubroutinesusedtoinsertanddeletebuffersfromthequeues conf.hreflectschangesmadeinthehandlingofswapspaceandchangesmadeforthe newselect(2)systemcall;theblockdevicetablehasanewmember,dpsize, whichreturnsthesizeofadiskpartition,insectors,givenamajor/minorvalue; thecharacterdevicetablehasanewmember,dselect,whichispassedadevt valueandanFREAD(FWRITE)flagandreturns1whendatamayberead (written),and0otherwise;theswdevtstructurenowincludesthesize,insectors, ofaswappartition dir.hiscompletelydifferentsincedirectoryentriesarenowvariablelength;definitions fortheuserlevelinterfaceroutinesdescribedindirectory(3)arealsopresent file.hhasaverydifferentfilestructuredefinitionanddefinitionsforthenewopenand flocksystemcalls;symbolicdefinitionsformanyconstantscommonlysuppliedto accessandlseek,arealsopresent inode.hreflectsthenewhashedcacheingschemeaswelladditionsmadetotheon-disk andin-coreinodes;on-diskinodesnowcontainacountoftheactualnumberof diskblocksallocatedafile(usedmostlybythediskquotafacilities),largertime stamps(forplannedchanges),moredirectblockpointers,androomforfuture growth;in-coreinodeshavenewfieldsfortheadvisorylockingfacilities,aback pointertothefilesystemsuperblockinformation(toeliminatelookups),anda pointertoastructureusedinimplementingdiskquotas. ioctl.hhasallrequestcodesconstructedfromIO,IOR,IOW,andIOWRmacros whichencodewhethertherequestrequiresdatacopiedin,out,orinandoutof thekerneladdressspace;thesizeofthedataparameter(inbytes)isalsoencoded intherequest,allowingtheioctl()routinetoperformalluser-kerneladdress spacecopies mount.hthemountstructurehasanewmemberusedinthediskquotafacilities param.hhashadnumerousitemsdeletedfromit;inparticular,manydefinitionslogically partofthe‘‘kernel’’havebeenmovedtokernel.h,andmachine-dependentvalues anddefinitionsarenowfoundinparam.hfileslocatedinmachine/param.h;containsamanifestconstant,NGROUPS,whichdefinesthemaximumsizeofthe groupaccesslist proc.hhaschangedextensivelyasaresultofthenewsignals,thedifferentresource usagestructure,thediskquotas,andthenewtimers;inaddition,newmembers arepresenttosimplifysearchingtheprocesstreeforsiblings;theSDLYUand SDETACHbitsaregone,theformerisreplacedbyasecondparametertopagein, thelatterisnolongerneededduetochangesinthehandlingofopen’son /dev/ttybyprocesseswhichhavehadtheircontrollingterminalrevokedwith vhangup -5-signal.hreflectsthenewsignalfacilities;severalnewsignalshavebeenadded:SIGIOfor signaldriveni/o;SIGURGfornotificationwhenanurgentconditionarises;and SIGPROFandSIGVTALRMforthenewtimerfacilities;structuresusedinthe sigvec(2)andsigstack(2)systemcalls,aswellassignalhandlerinvocationsare definedhere stat.hhasbeenupdatedtoreflectthechangestotheinodestructure;inadditionanew fieldstblksizecontainsan‘‘optimalblockingfactor’’forperformingi/o(forfiles thisistheblocksizeoftheunderlyingfilesystem) systm.hhasbeentrimmedbackabitasvariousitemsweremovedtokernel.h time.hcontainsthedefinitionsforthenewtimeandintervaltimerfacilities;timezone definitionsforthehalfdozentimezonesunderstoodbythesystemarealso includedhere tty.hreflectschangesmadetotheinternalstructureoftheterminalhandler;the ‘‘local’’structureshavebeenmergedintothestandardflagsandcharacterdefinitionsthoughtheuserinterfaceisvirtuallyidenticaltothatof4.1BSD;theTTY-HOGvaluehasbeenchangedfrom256to255toaccountforacountingproblem intheterminalhandleroninputbufferoverflow user.hhasbeenextensivelymodified;membershavebeengroupedandcategorizedto reflectthe‘‘4.2BSDSystemManual’’presentation;newmembershavebeen addedandexistingmemberschangedtoreflect:thenewgroupsfacilities,changes toresourceaccountingandlimiting,newtimerfacilities,andnewsignalfacilities vmmac.hhashadmanymacrodefinitionschangedtoeliminateassumptionsaboutthe hardwarevirtualmemorysupport;inparticular,thestackanduserareapage tablemapsarenolongerassumedtobeadjacentormappedbyasinglepage tablebaseregister vmparam.hnowincludesmachine-dependentdefinitionsfromafilemachine/vmparam.h. vmsystm.hhashadseveralmachine-dependentdefinitionsmovedtomachine/vmparam.h 3.2./sys/sys Thisdirectorycontainsthe‘‘mainstream’’kernelcode.Filesinthisdirectoryareintendedto besharedbetween4.2BSDimplementationsonallmachines.Asthereislittlecorrespondence betweenthecurrentfilesinthisdirectoryandthosewhichwerepresentin4.1BSDageneral overviewofeachfiles’scontentswillbepresentedratherthanafile-by-filecomparison. Filesinthesysdirectoryarenamedwithprefixeswhichindicatetheirplacementinthe internalsystemlayering.Thefollowingtablesummarizesthesenamingconventions. initsysteminitialization kernkernel(authentication,processmanagement,etc.) quotadiskquotas syssystemcallsandsimilar ttyterminalhandling ufsfilesystem uipcinterprocesscommunication vmvirtualmemory 3.2.1.Initializationcode initmain.ccontainssystemstartupcode initsysent.ccontainsthedefinitionofthesysenttable−thetableofsystemcallssupported by4.2BSD -6-3.2.2.Kernel-levelsupport kernacct.ccontainscodeusedinper-processaccounting kernclock.ccontainscodeforclockprocessing;workwasdoneheretominimizetimespent inthehardclockroutine;supportforkernelprofilingandstatisticscollection fromanalternateclocksourcehavebeenadded;abugwhichcausedthesystemtolosetimehasbeenfixed;thecodewhichdrainedterminalmultiplexor siloshasbeenmadethedefaultmodeofoperationandmovedtolocore.s kerndescrip.ccontainscodeformanagementofdescriptors;descriptorrelatedsystemcalls suchasdupandclose(theupper-mostlevels)arepresenthere kernexec.ccontainscodefortheexecsystemcall kernexit.ccontainscodefortheexitsystemcall kernfork.ccontainscodeforthefork(andvfork)systemcall kernmman.ccontainscodeformemorymanagementrelatedcalls;thecontentsofthisfileis expectedtochangewhentherevampedmemorymanagementfacilitiesare addedtothesystem kernproc.ccontainscoderelatedtoprocessmanagement;inparticular,supportroutines forprocessgroups kernprot.ccontainscoderelatedtoaccesscontrolandprotection;thenotionsofuserID, groupID,andthegroupaccesslistareimplementedhere kernresource.ccoderelatedtoresourceaccountingandlimits;thegetrusageand‘‘get’’and ‘‘set’’resourcelimitsystemcallsarefoundhere kernsig.cthesignalfacilities;inparticular,kernellevelroutinesforpostingandprocessingsignals kernsubr.csupportroutinesformanipulatingtheuiostructure:uiomove,ureadc,and uwritec kernsynch.ccoderelatedtoprocesssynchonizationandscheduling:sleepandwakeup amongothers kerntime.ccoderelatedtoprocessingtime;thehandlingofintervaltimersandtimeof day kernxxx.cmiscellaneoussystemfacilitiesandcodeforsupporting4.1BSDcompatibility mode(kernellevel) 3.2.3.Diskquotas quotakern.c‘‘kernel’’ofdiskquotasuppport quotasubr.cmiscellaneoussupportroutinesfordiskquotas quotasys.cdiskquotasystemcallroutines quotaufs.cportionsofthediskquotafacilitieswhichinterfacetothefilesystemroutines 3.2.4.Generalsubroutines subrmcount.ccodeusedwhenprofilingthekernel subrprf.cprintfandfriends;also,coderelatedtohandlingofthediagnosticmessage buffer subrrmap.csubroutineswhichmanageresourcemaps subrxxx.cmiscellaneousroutinesandcodeforroutinesimplementedwithspecialVAX instructions,e.g.bcopy -7-3.2.5.Systemlevelsupport sysgeneric.ccodefortheupper-mostlevelsofthe‘‘generic’’systemcalls:read,write,ioctl, andselect;a‘‘mustread’’fileforthesystemgurutryingtoshakeout4.1BSD badhabits sysinode.ccodesupportingthe‘‘generic’’systemcallsofsysgeneric.castheyapplyto inodes;thegutsofthebytestreamfilei/ointerface sysprocess.ccoderelatedtoprocessdebugging:ptraceanditssupportroutineprocxmt;this fileisexpectedtochangeasbetterprocessdebuggingfacilitiesaredeveloped syssocket.ccodesupportingthe‘‘generic’’systemcallsofsysgeneric.castheyapplyto sockets 3.2.6.Terminalhandling tty.ctheterminalhandlerproper;both4.1BSDandversion7terminalinterfaces havebeenmergedintoasinglesetofroutineswhichareselectedaslinedisciplines;abugwhichcausednewlinedelayspastcolumn127tobecalculated incorrectlyhasbeenfixed;thehighwatermarksforterminalsrunningintandemmodeat19.2or38.4kilobaudhavebeenupped ttybk.ctheoldBerknetlinediscipline(defunct) ttyconf.cinitializeddatastructuresrelatedtoterminalhandling; ttypty.csupportforpseudo-terminals;actuallytwodevicedriversinone;additionsover 4.1BSDpseudo-terminalsincludeasimple‘‘packetprotocol’’usedtosupport flow-controlandoutputflushingoninterrupt,aswellasa‘‘transparent’’mode usedinprogramssuchasemacs ttysubr.cc-listsupportroutines ttytb.ctwolinedisciplinesforsupportingRS232interfacestoGeniscoandHitachi tablets ttytty.ctrivialsupportroutinesfor‘‘/dev/tty’’ 3.2.7.Filesystemsupport ufsalloc.ccodewhichhandlesallocationanddeallocationoffilesystemrelatedresources: diskblocks,on-diskinodes,etc. ufsbio.cblocki/osupport;thebuffercacheproper;seedescriptionofbuf.hand‘‘AFast FileSystemforUNIX’’forinformation ufsbmap.ccodewhichhandleslogicalfilesystemtologicaldiskblocknumbermapping; understandsstructureofindirectblocksandfileswithholes;handlesautomatic extensionoffilesonwrite ufsdsort.csortroutineimplementingprioritizedseeksortalgorithmfordiski/ooperations ufsfio.ccodehandlingfilesystemspecificissuesofaccesscontrolandprotection ufsinode.cinodemanagementroutines;in-coreinodesarenowhashedandcached;inode synchronizationhasbeenrevampedsince4.1BSDtoeliminateraceconditions presentin4.1 ufsmount.ccoderelatedtodemountablefilesystems ufsnami.cthenameiroutine(andrelatedsupportroutines)−theroutinethatmaps pathnamestoinodenumbers ufssubr.cmiscellaneoussubroutines:thiscodeissharedwithcertainuserprogramssuch asfsck(8);foragoodtimelookatthebufstatsroutineinthisfile -8-ufssyscalls.cfilesystemrelatedsystemcalls,everythingfromopentounlink;manynewsys-temcallsarefoundhere:rename,mkdir,rmdir,truncate,etc. ufstables.cstatictablesusedinblockandfragmentaccounting;thisfileissharedwith userprogramssuchasfsck(8) ufsxxx.cmiscellaneousroutinesand4.1BSDcompatibilitycode;allofthecodewhich stillunderstandstheoldinodeformatisinhere 3.2.8.Interprocesscommunication uipcdomain.ccodeimplementingthe‘‘communicationdomain’’concept;thisfilemustbe augmentedtoincorporatenewdomains uipcmbuf.cmemorymanagementroutinesfortheipcandnetworkfacilities;refertothe document‘‘4.2BSDNetworkingImplementationNotes’’foradetaileddescriptionoftheroutinesinthisfile uipcpipe.cleftovercodeforconnectingtwosocketsintoapipe;actuallyaspecialcaseof thecodeforthesocketpairsystemcall uipcproto.cUNIXipccommunicationdomainconfigurationdefinitions;containsUNIX domaindatastructureinitialization uipcsocket.ctoplevelsocketsupportroutines;theseroutineshandletheinterfacetothe protocolrequestroutines,movedatabetweenuseraddressspaceandsocket dataqueues,understandthemajorityofthelogicinprocesssynchronizationas itrelatestotheipcfacilities uipcsocket2.clowerlevelsocketsupportroutines;providenittygrittybittwiddlingofsocket datastructures;manageplacementofdataonsocketdataqueues uipcsyscalls.cuserinterfacecodetoipcsystemcalls:socket,bind,connect,accept,etc.;concernedexclusivelywithsystemcallargumentpassingandvalidation uipcusrreq.cUNIXipcdomainsupport;userrequestroutineandsupportingutilityroutines 3.2.9.Virtualmemorysupport Thecodeinthevirtualmemorysubsystemhaschangedverylittlefrom4.1BSD;changes madeinthesefileswereeithertogainportability,handlethenewswapspaceconfiguration scheme,orfixbugs. vmdrum.ccodeforthemanagementofdiskspaceusedinpagingandswapping vmmem.cmanagementofphysicalmemory;the‘‘coremap’’isimplementedhereaswell astheroutineswhichlockdownpagesforphysicali/o(thelatterwillhaveto changewhenthememorymanagementfacilitiesaremodifiedtosupportsharingofpages);asignextensionbugonblocknumbersextractedfromthecore maphasbeenfixed(thiscausedthesystemtocrashwithcertaindiskpartition layoutsonRA81disks) vmmon.csupportforvirtualmemorymonitoring;codeinthisfileisincludedinthesystemonlyifthePGINPROFand/orTRACEoptionsareconfigured vmpage.cthecodewhichhandlesandprocessespagefaults:pagein;raceconditionsin accessingpagesintransitandrequeststolockpagesforrawi/ohavebeen fixedinthiscode;amajorpaththroughpageinwhosesolepurposewasto implementthesoftwaresimulatedreferencebithasbeen‘‘parallelcoded’’in assemblylanguage(thisappearstodecreasesystemtimebyatleast5%when asystemispagingheavily);pageinnowhasasecondparameterindicatingif thepagetobefaultedinshouldbeleftlocked(thiseliminatedtheneedforthe SDLYUflagintheprocstructure) vmproc.cmainlycodetomanagevirtualmemoryallocationduringprocesscreationand destruction(thevirtualmemoryequivalentof‘‘passingthebuck’’isdone -9-here). vmpt.ccodeformanipulatingprocesspagetables;knowledgeoftheuserareaisfound hereasitrelatestotheuseraddressspacepagetables vmsched.cthecodeforprocess0,thescheduler,liveshere;otherroutineswhichmonitor andmetervirtualmemoryactivity(usedinimplementinghighlevelscheduling policies)alsoarepresent;thiscodehasbeenbetterparameterizedtoisolate machine-dependentheuristicsusedintheschedulingpolicies vmsubr.cmiscellaneousroutines:someformanipulatingaccessabilityofvirtualmemory, othersformappingvirtualaddressestologicalsegments(text,data,stack) vmsw.cindirectdriverforinterleaved,multi-controller,pagingarea;modifiedtosup-portinterleavedpartitionsofdifferentsizes vmswap.ccodetohandleprocessrelatedissuesofswapping vmswp.ccodetohandleswapi/o vmtext.ccodetohandlesharedtextsegments−the‘‘text’’table 3.3./sys/conf Thisdirectorycontainsfilesusedinconfiguringsystems.Theformatofconfigurationfiles haschangedslightly;itisdescribedcompletelyinanewdocument‘‘Building4.2BSDUNIXSystemswithConfig’’.Severalnewfilesexistforusebytheconfig(8)program,andseveraloldfiles havehadtheirmeaningchangedslightly. LINTanewconfigurationfileforuseinlintingkernels devices.vaxmapsblockdevicenamestomajordevicenumbers(ontheVAX) filesnowhasonlyfilescontainingmachine-independentcode files.xxx(wherexxxisasystemname)optional,xxx-specificfilesfiles files.vaxnewfiledescribingfileswhichcontainmachine-dependentcode makefile.vaxmakefiletemplatespecifictotheVAX param.cupdatedcalculationsofntextandnfiletoreflectnetworkrequirements;new quantitiesaddedfordiskquotas 3.3.1./sys/vaxuba ThisdirectorycontainsUNIBUSdevicedriversandtheirrelatedincludefiles.Thelatter havemovedfrom/sys/hinanefforttoisolatemachine-dependentportionsofthesystem.The followingdevicedriverswerenotpresentinthe4.1BSDrelease. ad.cadriverfortheDataTranslationA/Dconverter ik.canIkonasframebuffergraphicsinterphase;useraccesstothedeviceisimplementedby mappingthedeviceregistersdirectlyintothevirtualaddressspaceofauser(theroutinestomapmemoryareincludedinuba.conlyifanIkonasisconfiguredinthesystem) kgclock.c adriverforaDL11-WorKL11-Wusedasanauxiliaryreal-timeclocksourceforker-nelprofilingand/orstatisticsgathering;ifthisdeviceispresent,thesystemwillauto-maticallycollectitsi/ostatistics(andifprofiling,pcsamples)offthesecondaryclock; veryusefulinkernelprofilingasthesecondclocksourceeliminatesmostofthestatisticalanomaliesandshowsthetruetimespentintheclockroutine ps.cdriverforanEvansandSutherlandPictureSystem2 rl.cdriverforRL11controllerwithRL02cartridgedisks;doesnotsupportRL01disks thoughitshouldonlyrequireadditionstodiskgeometryandpartitiontables -10-rx.cdriverforRX211floppydiskcontroller;providesbothblockandcharacterdeviceinter-faces;ioctlcallssupportfloppydiskformattingand‘‘deleteddatamark’’sensingand writing;makesagreatpagingdevice ut.cdriverfortapecontrollerswhichemulateaTU45ontheUNIBUS;inparticular,the SystemIndustriesModel9700tripledensitytapedrive uu.cdriverfordualUNIBUSTU58cartridgetapecassettesaccessedthroughaDL11serial line;usesassemblylanguagecodeinlocore.swhichprovidespseudo-DMAoninput (necessarytoavoiddataoverruns);usingthisdriverwhilethesystemrunsmulti-user degradesresponseseverely(developedatBerkeleyexclusivelytoproducedistribution TU58cassettes) Inadditiontotheabovedevicedrivers,manydriverspresentin4.1BSDnowsportcorrespondingincludefileswhichcontaindeviceregisterdefinitions.Forexample,theDH11driveris nowbrokenintothreefiles:dh.c,dhreg.h,anddmreg.h. Thefollowingdrivershavebeensignificantlymodified,orhadbugsfixedinthem,sincethe 4.1BSDrelease: dh.cchangestoreflecttherevisedttydataorganization dmf.cabugwheredeviceregisteraccessescausedunwittingmodificationofcertainstatus bitshasbeenfixed;modemcontrolhasbeenfixed;aremnantoftheDH11includefile whichcausedincorrectdefinitionsforeven/oddparityhasbeenfixed;changesto reflecttherevisedttydataorganization dz.cnowsupportstheDZ32;changestoreflecttherevisedttydataorganization lp.cnowtakesanon-zeroflagsvaluespecifiedintheconfigurationfileastheprinterwidth (defaultis132columns);thus,toconfigurean80columnprinter,include‘‘flags80’’in thedevicespecification rk.caraceconditionhasbeenfixedwhereaseekfinishingononedriveappearedasani/o transfercompleteingonanother(thisbugactuallywaspresentinallUNIBUSdisk drivers);changesforuioandswapspaceconfiguration tm.catypowhichmadethesystemcrashwithmultipleslavesonasinglecontrollerhas beenfixed;anincorrectprioritylevelchangeinthewatchdogtimerroutinewhich causedthesystemtocrashwhenadeviceoperationtimedouthasbeenfixed;changes foruioprocessingofrawi/o ts.cchangesforuioprocessingofrawi/o uba.canewsupportroutineforallocatingUNIBUSmemoryformemory-mappeddevices suchasthe3ComEthernetinterface;thehandlingofUNIBUSresetshasbeen changed,allUNIBUSresourcesarenowreclaimedintheubaresetroutinepriortocallingindividualdevicedriverresetroutines−thisimpliesdriverresetroutinesshouldno longerfreeupallocatedUNIBUSresources;newroutinesformappingUNIBUSmemoryintothevirtualaddressspaceofaprocesshavebeenaddedtosupporttheIkonas devicedriver;changestofixtheraceconditiondescribedaboveintheRK07device driver;processesawaitingUNIBUSmapregistersnowsleeponadifferenteventthan thosewaitingforbuffereddatapaths uda.ctheproblemwithmultiplexingbuffereddatapathsonan11/750hasbeenfixed;abug inthesetupoftheuidkfieldhasbeenfixed;nowproperlydefinesthefieldindicating thedisktransferrate;changesforuioprocessingandswapspaceconfiguration up.cnowsupportsECCcorrectionandbadsectorforwarding;significantchangeshavebeen madetomakeconfigurationofvariousdiskdrivessimple(byprobingtheholdingregisterandusingtheresultantvalueindicatingthenumberoftracksonthedisk);therace conditiondescribedunderrk.chasbeenfixed;referencestoUNIBUSmapregistersare nowdonewithlongwordinstructionssothedevicedriverdoesnotcausethesystemto crashwhenanECCorbadsectorerroroccursonadiskattachedtoa730UNIBUS; -11-theupSDIST/upRDISTparameterswhichcontroltheuseofsearchandseekopera-tionsoncontrollerswithmultipledriveshavebeenmadedrivedependent;abug wherebytheproberoutinewouldbelivecertainnon-existantdriveswerepresenthas beenfixed;changesforuioprocessingandswapspaceconfiguration va.chasbeenrewrittentohonorthesoftwaresupportforexclusiveaccesstotheUNIBUS sothatthedevicemaycoexistonthesameUNIBUSwithRK07diskdrives;thedriver nowworkswithcontrollerswhichhaveaGObit 3.3.2./sys/vax Thefollowingfilesarenewin4.2BSD: crt0.exeditscriptforcreatingaprofiledkernel frame.hcopiedfrom/usr/include incksum.cchecksumroutinefortheDARPAInternetprotocols param.hmachine-dependentportionof/sys/h/param.h pupcksum.cchecksumroutineforPUP-Iprotocols rsp.hprotocoldefinitionsforcommunicatingwithaTU58 sysmachdep.c machine-dependentportionofthe‘‘sys*’’filesof/sys/sys ufsmachdep.c machine-dependentportionofthe‘‘ufs*’’filesof/sys/sys vmmachdep.c machine-dependentportionofthe‘‘vm*’’filesof/sys/sys vmparam.hmachine-dependentportionof/sys/h/vmparam.h Thefollowingfileshavebeenmodifiedfor4.2BSD: Locore.cincludesnewdefinitionsforlintingthenetworkandipccode asm.sednowmassagesinsque,remque,andvariousroutineswhichdobyteswappinginto assemblylanguage autoconf.chandlesMASSBUSdriveswhichcomeon-lineaftertheinitialautoconfiguration process;sizesandconfiguresswapspaceatboottimeinadditiontocalculating theswapareaallocationparametersdmtext,dmmax,anddmmin(whichwere manifestconstantsin4.1BSD);calculatesthediskpartitionoffsetforsystem dumpsatboottimetotakeintoaccountvariablesizedswapareas;nowusesthe per-driverarrayofstandardcontrolstatusregisteraddresseswhenprobingfor devicesontheUNIBUS;nowallowsMASSBUStapesanddiskstobewildcarded acrosscontrollers conf.cusesmany‘‘local’’spacesfornewanduncommondevicedrivers genassym.cgeneratesseveralnewdefinitionsforuseinlocore.s locore.sincludescodetovectorsoftwareinterruptstoprotocolprocessingmodules; assemblylanguageassistroutinesfortheconsoleandUNIBUSTU58cassette drives;anewroutine,Fastreclaimisafastcodingofamajorpaththroughthe pageinroutine;copyinandcopyoutnowhandlegreaterthan64Kbytedatacopies andreturnEFAULTonfailure;understandsthenewsignaltrampolinecode;now containscodefordrainingterminalmultiplexorsilosatclocktime;abugwherea thetranslationbufferwassometimesbeingimproperlyflushedduringaresume operationhasbeenfixed machdep.cabugwhichcausedmemoryerrorstonotbereportedon11/750’shasbeen fixed;hasnewcodeforhandlingthenewsignals;recoversfromtranslationbuffer parityfaultmachinechecksapparentlycausedbysubstandardmemorychips usedinmany11/750’s;includesoptionalcodetopinpointbadmemorychipson -12-Trendatamemoryboards;themachinecheckroutinenowcallsthememerrrou-tinetoprintoutthememorycontrollerstatusregistersincasethefaultoccurred becauseofamemoryerror mem.cnowhascorrectdefinitionstoenablecorrectablememoryerrorreportingon 11/750’s:DECdocumentationincorrectlyspecifiesuseoftheICRDbit pcb.hhaschangesrelatedtothenewsignaltrampolinecode swapgeneric.csupportsmoredeviceswhichcanbeusedasagenericrootdevice;interactswith thenewswapconfigurationcodetosizetheswapareaproperlywhenrunninga genericsystem;understandsthespecial‘‘swaponroot’’devicesyntaxusedwhen installingthesystem trap.ccanbecompiledwithaSYSCALLTRACEdefinetoallowsystemcallstobe tracedwhenthevariablesyscalltraceisnon-zero; tu.cincludes(limited)supportfortheTU58consolecassetteonthe11/750,sufficient foruseinsingle-usermode;supportstheuseoftheMRSPROMonthe11/750. 3.3.3./sys/vaxmba ThefollowingbugfixesandmodificationshavebeenappliedtotheMASSBUSdevice drivers: hp.calargenumberofdiskdrivesattachedtosecondvendordiskcontrollersarenowautomaticallyrecognizedatboottimebyprobingtheholdingregisterandusingdiskgeometryinformationtodecidewhatkindofdriveispresent;thehpSDIST/hpRDIST parametersthatcontrolseekandsearchoperationsoncontrollerswithmultipledrives havebeenmadeaper-driveparameter;abugwherethesectornumberreportedona harderrorwasoffbyonehasbeenfixed;theerrorrecoverycodenowsearchesthebad sectortablewhenaheaderCRCerroroccurs;theerrorrecoverycodenowhandlesbad sectorsontrackswhichalsohaveskipsectors;abuginthehandlingofECCerrorshas beenfixed;manyseparatedriverdatastructureshavebeenconsolidatedintothesoftwarecarrierstructure;thedriverhandlestheML-11solid-statedisk mba.cnowautoconfiguresMASSBUStapesanddiskswhich‘‘comeon-line’’aftertheinitial boot 4.Standalonesupport Thissectiondescribeschangesmadetothestandalonei/ofacilitiesandthenewmethods usedinsystembootstrapping. 4.1.Diskformatting Anewdiskformattingprogramhasbeendevelopedforusewithnon-DECUNIBUSand MASSBUSdiskcontrollers.Theformat(8V)programhasbeentestedmainlywithdiskdrives attachedtoEmulexMASSBUSandUNIBUSdiskcontrollers,butshouldoperatewithanycontrollerwhichhandlesbadsectorforwardinginanidenticalfashiontoDECRM03/RM05orRM80 (butnotRP06)diskcontrollers.TheprogramrunsstandaloneformattingdiskheadersandcreatingabadsectortableintheDECstandard144format. 4.2.Standalonei/olibrary Changestosupportmorecomplexstandalonei/oapplicationsaswellaschangesforthenewfile systemorganization,haveresultedinsignificantrevisionstothestandalonei/olibrary.Device driversnowsupportanewentrypointforioctlrequestsandlibraryroutinesnowreturnerror codesalatheUNIXsystemcalls.Inaddition,standalonei/olibraryroutinesnowmakemany moreinternalconsistencycheckstoverifydatastructureshavenotbeencorruptedbyfaulty devicedriversandthati/oerrorshavenotoccurredwhenreadingcriticalfilesysteminformation. Inconjunctionwiththenewdiskformatter,theupandhpstandalonedrivershavebeenrewritten -13-tosupportECCcorrectionandbadsectorhandling.Thesedriversareusedinbootstrappingfrom theconsolemediaon11/780’sand11/730’stherebyeliminatingtherequirementforerrorfreeroot partitionsondisksattachedtohpandupcontrollers.Manybugsinthestandalonetapedrivers havebeenfixed. 4.3.Systembootstrapping On11/780’sand11/730’s,theconsoledeviceisstillusedtoloadthe‘‘boot’’program.This inturnloadsthesystemimagefromtherootfilesystem. Themethodbywhichthesystembootstrapson11/750’sisdifferentin4.2BSD.Thesystem isstillbootstrappedfromdiskusingabootblockinsector0oftherootfilesystempartition,but nowthisbootblocksimplyreadsinthenext7.5kilobytes.The7.5kilobyteprogramisaversion ofthe‘‘/boot’’programloadedonlywiththedevicedriverrequiredtoreadthe‘‘/boot’’program fromtherootfilesystem.The‘‘/boot’’programthenreadsinthesystemimage,asdoneon 11/780’sand11/730’s. Theadditionallevelofbootstrapcodewasdonetosimplifythesector0bootprogramsand minimizethetotalamountofassemblylanguagecodewhichhadtobemaintained.Itwasalso expectedthat7.5kilobyteswouldbesufficienttoallowthenewhpandupstandalonedrivers whichsupportECCcorrectionandbadsectorhandlingtobeused.Unfortunately,thestandalone systemhasnotyetbeentrimmeddowntoallowthesecondlevelbootprograms,loadedwiththe newdrivers,tofitinthespaceprovided.SiteswhichhaveWinchesterdiskdriveswithbadsectorsintherootfilesystempartitionandwhichrequirethissupportshouldbeabletotrimthesize ofthesecondlevelbootprogramtomakeitfit.