📄 p1
字号:
he may also create subdirectories to containgroups of files conveniently treated together.A directory behaves exactly like an ordinary file except that itcannot be written on by unprivileged programs, so that the systemcontrols the contents of directories.However, anyone withappropriate permission may read a directory just like any other file..PPThe system maintains several directoriesfor its own use.One of these is the.UL rootdirectory.All files in the system can be found by tracinga path through a chain of directoriesuntil the desired file is reached.The starting point for such searches is often the.UL root .Other system directories contain all the programs providedfor general use; that is, all the.IT commands .As will be seen, however, it is by no means necessarythat a program reside in one of these directories for itto be executed..PPFiles are named by sequences of 14 orfewer characters.When the name of a file is specified to thesystem, it may be in the form of a.IT path.IT name ,whichis a sequence of directory names separated by slashes, ``/\^'',and ending in a file name.If the sequence begins with a slash, the search begins in theroot directory.The name.UL /alpha/beta/gammacauses the system to searchthe root for directory.UL alpha ,then to search.UL alphafor.UL beta ,finally to find.UL gammain.UL beta ..UL \&gammamay be an ordinary file, a directory, or a specialfile.As a limiting case, the name ``/\^'' refers to the root itself..PPA path name not starting with ``/\^'' causes the system to begin thesearch in the user's current directory.Thus, the name.UL alpha/betaspecifies the file named.UL betainsubdirectory.UL alphaof the currentdirectory.The simplest kind of name, for example,.UL alpha ,refers to a file that itself is found in the currentdirectory.As another limiting case, the null file name refersto the current directory..PPThe same non-directory file may appear in several directories underpossibly different names.This feature is called.IT linking ;a directory entry for a file is sometimes called a link.The.UXsystemdiffers from other systems in which linking is permittedin that all links to a file have equal status.That is, a file does not exist within a particular directory;the directory entry for a file consists merelyof its name and a pointer to the information actuallydescribing the file.Thus a file exists independently of anydirectory entry, although in practice a file is made todisappear along with the last link to it..PPEach directory always has at least two entries.The name``\|\fB.\|\fP'' in each directory refers to the directory itself.Thus a programmay read the current directory under the name ``\fB\|.\|\fP'' without knowingits complete path name.The name ``\fB\|.\|.\|\fP'' by convention refers to the parent of thedirectory in which it appears, that is, to the directory in whichit was created..PPThe directory structure is constrained to have the formof a rooted tree.Except for the special entries ``\|\fB\|.\|\fP'' and ``\fB\|.\|.\|\fP'', each directorymust appear as an entry in exactly one other directory, which is itsparent.The reason for this is to simplify the writing of programsthat visit subtrees of the directory structure, and moreimportant, to avoid the separation of portions of the hierarchy.If arbitrary links to directories were permitted, it wouldbe quite difficult to detect when the last connection fromthe root to a directory was severed..SH3.3 Special files.PPSpecial files constitute the most unusual feature of the.UXfile system.Each supported I/O deviceis associated with at least one such file.Special files are read and written just like ordinarydisk files, but requests to read or write result in activation of the associateddevice.An entry for each special file resides in directory.UL /dev ,although a link may be made to one of these filesjust as it may to an ordinary file.Thus, for example,to write on a magnetic tapeone may write on the file.UL /dev/mt .Special files exist for each communication line, each disk,each tape drive,and for physical main memory.Of course,the active disksand the memory special file are protected fromindiscriminate access..PPThere is a threefold advantage in treatingI/O devices this way:file and device I/Oare as similar as possible;file and device names have the samesyntax and meaning, so thata program expecting a file nameas a parameter can be passed a devicename; finally,special files are subject to the sameprotection mechanism as regular files..SH3.4 Removable file systems.PPAlthough the root of the file system is always stored on the samedevice,it is not necessary that the entire file system hierarchyreside on this device.There is a.UL mountsystem request with two arguments:the name of an existing ordinary file, and the name of a specialfile whose associatedstorage volume (e.g., a disk pack) should have the structureof an independent file systemcontaining its own directory hierarchy.The effect of.UL mountis to causereferences to the heretofore ordinary fileto refer instead to the root directoryof the file system on the removable volume.In effect,.UL mountreplaces a leaf of the hierarchy tree (the ordinary file)by a whole new subtree (the hierarchy stored on theremovable volume).After the.UL mount ,there is virtually no distinctionbetween files on the removable volume and those in thepermanent file system.In our installation, for example,the root directory resideson a small partition of one ofour disk drives,while the other drive,which contains the user's files,is mounted by the system initializationsequence.A mountable file system is generated bywriting on its corresponding special file.A utility program is available to createan empty file system,or one may simply copy an existing file system..PPThere is only one exception to the rule of identicaltreatment of files on different devices:no link may exist between one file system hierarchy andanother.This restriction is enforced so as to avoidthe elaborate bookkeepingthat would otherwise be required to assure removal of the linkswhenever the removable volume is dismounted..SH3.5 Protection.PPAlthough the access control schemeis quite simple, it has some unusual features.Each user of the system is assigned a uniqueuser identification number.When a file is created, it is marked withthe user \*sID\*n of its owner.Also given for new filesis a set of ten protection bits.Nine of these specifyindependently read, write, and execute permissionfor theowner of the file,for other members of his group,and for all remaining users..PPIf the tenth bit is on, the systemwill temporarily change the user identification(hereafter, user \*sID\*n)of the current user to that of the creator of the file wheneverthe file is executed as a program.This change in user \*sID\*n is effective onlyduring the execution of the program that calls for it.The set-user-\*sID\*n feature providesfor privileged programs that may use filesinaccessible to other users.For example, a program may keep an accounting filethat should neither be read nor changedexcept by the program itself.If the set-user-\*sID\*n bit is on for theprogram, it may access the file althoughthis access might be forbidden to other programsinvoked by the given program's user.Since the actual user \*sID\*nof the invoker of any programis always available,set-user-\*sID\*n programsmay take any measures desired to satisfy themselvesas to their invoker's credentials.This mechanism is used to allow users to executethe carefully writtencommandsthat call privileged system entries.For example, there is a system entryinvokable only by the ``super-user'' (below)that createsan empty directory.As indicated above, directories are expected tohave entries for ``\fB\|.\|\fP'' and ``\fB\|.\|.\|\fP''.The command which creates a directoryis owned by the super-userand has the set-user-\*sID\*n bit set.After it checks its invoker's authorization tocreate the specified directory,it creates it and makes the entriesfor ``\fB\|.\|\fP'' and ``\fB\|.\|.\|\fP''..PPBecause anyone may set the set-user-\*sID\*nbit on one of his own files,this mechanism is generallyavailable without administrative intervention.For example,this protection scheme easily solves the \*sMOO\*naccounting problem posed by ``Aleph-null.''.[aleph null software practice.].PPThe system recognizes one particular user \*sID\*n (that of the ``super-user'') asexempt from the usual constraints on file access; thus (for example),programs may be written to dump and reload the filesystem withoutunwanted interference from the protectionsystem.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -