📄 regen
字号:
make unix.DEif the libraries /usr/sys/dev/LIB2 and /usr/sys/sys/LIB1,and also c.o and l.o,are correct.Use.DScd /usr/sys/confmake all.DEto recompile everythingand recreate the libraries from scratch.This is needed, for example, when a header includedin several source files is changed.See `Setting Up UNIX' for other information about configurationand such..PPWhen the make isdone, the new system is present in thecurrent directory as `unix'.It should be tested before destroying the currentlyrunning `/unix', this is best done by doing something like.DSmv /unix /ounixmv unix /unix.DEIf the new system doesn't work, you can still boot `ounix'and come up (see boot(8)).When you have satisfied yourself that the new system works,remove /ounix..PPTo install a new device driver,compile it andput it into its library.The best way to put it intothe library is to use the command.DSar uv LIB2 x.o.DEwhere x is the routine you just compiled.(All the device drivers distributed withthe system are already in the library.).PPNext, the device's interrupt vector must be entered in l.s.This is probably already done by the routine mkconf(1), but if thedevice is esoteric or nonstandard you will have to massagel.s by hand.This involves placing a pointer to a callout routineand the device's priority level in the vector.Use some other device (like the console) as a guide.Notice that the entries in l.s must be in orderas the assembler does not permit moving thelocation counter `.' backwards.The assembler also does not permit assignation ofan absolute number to `.', which is thereason for the `. = ZERO+100' subterfuge.If a constant smaller than 16(10) is added to thepriority level,this number will be available as the first argument of the interrupt routine.This stratagem is used whenseveral similar devices share the same interrupt routine(as in dl11's)..PPIf you have to massage l.s, be sure to add the codeto actually transfer to the interrupt routine. Again usethe console as a guide. The apparent strangeness of this codeis due to running the kernel in separate I&D space.The.I callroutinesaves registers as required and prepares a C-stylecall on the actual interrupt routinenamed after the `jmp' instruction.When the routine returns,.I callrestores the registers and performs anrti instruction.As an aside, note thatexternal names in C programs have anunderscore (`_') prepended to them..PPThe second step which must be performed to add a device unknown to mkconf isto add it to the configuration table/usr/sys/conf/c.c.This file contains two subtables,one for block-type devices, and one for character-type devices.Block devices include disks, DECtape, and magtape.All other devices are character devices.A line in each of these tables gives all the informationthe system needs to know about the device handler;the ordinal position of the line in the table impliesits major device number, starting at 0..PPThere are four subentries per line in the block device table,which give its open routine, close routine, strategy routine, anddevice table.The open and close routines may be nonexistent,in which case the name `nulldev' is given;this routine merely returns.The strategy routine is called to do any I/O,and the device table contains status information for the device..PPFor character devices, each line in the tablespecifies a routine for open,close, read, and write, and one which sets and returnsdevice-specific status (used, for example, for stty and gttyon typewriters).If there is no open or close routine, `nulldev' maybe given; if there is no read, write, or statusroutine, `nodev' may be given.Nodev sets an error flag and returns..PPThe final step which mustbe taken to install a device is to make a special file for it.This is done by mknod(1), to which you must specify thedevice class (block or character),major device number (relative line in the configuration table)and minor device number(which is made available to the driver at appropriate times)..PPThe documents`Setting up Unix' and`The Unix IO system'may aid in comprehending these steps..SHThe Library libc.a.PPThe library /lib/libc.a is where most of the subroutinesdescribed in sections 2 and 3 of the manual are kept.This librarycan be remade using the following commands:.DScd /usr/src/libcsh compallsh mklibmv libc.a /lib/libc.a.DEIf single routines need to be recompiled and replaced, use.DScc \-c \-O x.car vr /lib/libc.a x.orm x.o.DEThe above can also be used to put new items into the library.See ar(1), lorder(1), and tsort(1)..PPThe routines in /usr/src/cmd/libc/csu (C start up) are not inlibc.a. These are separately assembled and put into/lib. The commands to do this are.DScd /usr/src/libc/csuas \- x.smv a.out /lib/x.DEwhere x is the routine you want..SHOther Libraries.PPLikewise,the directories containing the source for the other librarieshave files compall (that recompiles everything)and mklib (that recreates the library)..SHSystem Tuning.PPThere are several tunable parameters in the system. These setthe size of various tables and limits. They are found in thefile /usr/sys/h/param.h as manifests (`#define's).Their values are rather generous in the system as distributed.Our typical maximum number of users is about 20, but there aremany daemon processes..PPWhen any parameter is changed, it is prudent to recompilethe entire system, as discussed above.A brief discussion of each follows:.IP NBUF 12This sets the size of the disk buffer cache. Each buffer is 512 bytes.This number should be around 25 plus NMOUNT,or as big as can be if the above number ofbuffers cause the system to not fit in memory..IP NFILE 12This sets the maximum number of open files. An entry is made inthis table every time a file is `opened' (see open(2), creat(2)).Processes share these table entries across forks (fork(2)). This numbershould be about the same size as NINODE below. (It can be a bit smaller.).IP NMOUNT 12This indicates the maximum number of mounted file systems. Make itbig enough that you don't run out at inconvenient times..IP MAXMEM 12This sets an administrative limit on the amount of memorya process may have.It is set automatically if the amount of physical memory is small,and thus should not need to be changed..IP MAXUPRC 12This sets the maximum number of processes that any one user canbe running at any one time. This should be set just large enoughthat people can get work done but not so large that a user canhog all the processes available (usually by accident!)..IP NPROC 12This sets the maximum number of processes that can beactive.It depends on the demand pattern of the typical user;we seem to need about 8 times the numberof terminals..DE.IP NINODE 12This sets the size of the inode table. There is one entry in the inodetable for every open device, current working directory,sticky text segment,open file, and mounted device.Note that if two users have a file open there is still only one entryin the inode table. A reasonable rule of thumb for the size ofthis table is.DSNPROC + NMOUNT + (number of terminals).DE.IP SSIZE 12The initial size of a process stack. This may be made biggerif commonly run processes have large data areas on the stack..IP SINCR 12The size of the stack growth increment..IP NOFILE 12This sets the maximum number of files that any one process can haveopen.20 is plenty..IP CANBSIZ 12This is the size of the typewriter canonicalization buffer. It isin this buffer that erase and kill processing is done. Thus thisis the maximum size of an input typewriter line. 256 is usuallyplenty..IP CMAPSIZ 12The number of fragments that memory can be broken into. This shouldbe big enough that it never runs out.The theoretical maximum is twice the number of processes,but this is a vast overestimate in practice.50 seems enough..IP SMAPSIZ 12Same as CMAPSIZ except for secondary (swap) memory..IP NCALL 12This is the size of the callout table. Callouts are entered in thistable when some sort of internal system timing must be done, as incarriage return delays for terminals. The number must be big enoughto handle all such requests..IP NTEXT 12The maximum number of simultaneously executing pure programs. Thisshould be big enough so as to not run out of space under heavy load.A reasonable rule of thumb is about.DS(number of terminals) + (number of sticky programs).DE.IP NCLIST 12The number of clist segments. A clist segment is 6 characters.NCLIST should be big enough so that the list doesn't become exhaustedwhen the machine is busy. The characters that have arrived from a terminaland are waiting to be given to a process live here. Thus enough spaceshould be left so that every terminal can have at least one averageline pending (about 30 or 40 characters)..IP TIMEZONE 12The number of minutes westward from Greenwich. See `Setting Up UNIX'..IP DSTFLAG 12See `Setting Up UNIX' section on time conversion..IP MSGBUFS 12The maximum number of characters of system error messages saved. Thisis used as a circular buffer..IP NCARGS 12The maximum number of characters in an exec(2) arglist. Thisnumber controls how many arguments can be passedinto a process.5120 is practically infinite..IP HZ 12Set to the frequency of the system clock (e.g., 50 fora 50 Hz. clock).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -