Everything is a file
Special file types: {{nowrap}}
| ← Previous revision | Revision as of 07:55, 20 April 2026 | ||
| Line 76: | Line 76: | ||
Opening special files is beholden to the same [[file-system permissions]] checks as opening regular files, allowing common access control — |
Opening special files is beholden to the same [[file-system permissions]] checks as opening regular files, allowing common access control — |
||
chown dmr /usr/dmr /dev/rk0; chmod o= /usr/dmr /dev/rk0 changes the ownership and file access mode of both the directory /usr/dmr and device /dev/rk0. |
{{nowrap|1= chown dmr /usr/dmr /dev/rk0; chmod o= /usr/dmr /dev/rk0}} changes the ownership and file access mode of both the directory /usr/dmr and device /dev/rk0. |
||
For block devices ([[hard disks]] and [[tape drives]]), due to their size, this meant unique semantics: they were block-addressed (see {{cite encyclopedia |title=/DEV/RF0 (IV) |encyclopedia=UNIX Programmer's Manual |date=3 November 1971 |publisher=[[Bell Labs|Bell Laboratories]] |author=[[Ken Thompson]] and [[Dennis Ritchie]] |url=http://ftp.okass.net/pub/mirror/minnie.tuhs.org/Distributions/Research/Dennis_v1/UNIX_ProgrammersManual_Nov71.pdf#page=157 }}), and programs needed to be written specifically to work correctly with them. |
For block devices ([[hard disks]] and [[tape drives]]), due to their size, this meant unique semantics: they were block-addressed (see {{cite encyclopedia |title=/DEV/RF0 (IV) |encyclopedia=UNIX Programmer's Manual |date=3 November 1971 |publisher=[[Bell Labs|Bell Laboratories]] |author=[[Ken Thompson]] and [[Dennis Ritchie]] |url=http://ftp.okass.net/pub/mirror/minnie.tuhs.org/Distributions/Research/Dennis_v1/UNIX_ProgrammersManual_Nov71.pdf#page=157 }}), and programs needed to be written specifically to work correctly with them. |
||
| Line 83: | Line 83: | ||
In many cases, magnetic tapes continue to have unique semantics: |
In many cases, magnetic tapes continue to have unique semantics: |
||
some tapes can be partitioned into "files" and the driver signals an end-of-file condition after the end of a partition is reached, |
some tapes can be partitioned into "files" and the driver signals an end-of-file condition after the end of a partition is reached, |
||
so cp /dev/nrst0 file1; cp /dev/nrst0 file2 will create file1 and file2 consisting of two consecutive partitions of the tape |
so {{nowrap| cp /dev/nrst0 file1; cp /dev/nrst0 file2}} will create file1 and file2 consisting of two consecutive partitions of the tape |
||
— the driver provides an [[abstraction layer]] that presents a tape file descriptor as-if it were a regular file to fit into the '''Everything is a file''' paradigm. |
— the driver provides an [[abstraction layer]] that presents a tape file descriptor as-if it were a regular file to fit into the '''Everything is a file''' paradigm. |
||
Specialised programs like mt are used to move between partitions on a tape like this, |
Specialised programs like mt are used to move between partitions on a tape like this, |
||