The lowest level of I/O in UNIX System V provides no buffering or other such services, but it offers the most control over what happens. System calls that represent direct entries into the UNIX System V kernel control all user I/O. UNIX System V keeps the system calls that do I/O simple, uniform and regular to eliminate differences between files, devices and styles of access. The same read and write system calls apply to ordinary disk files and I/O devices such as terminals, tape-drives and line-printers. They do not distinguish between ``random'' and ``sequential'' I/O, nor do they impose any logical record size on files. Thus, a single, uniform interface handles all communication between programs and peripheral devices, and programmers can defer specifying devices from program-development until program-execution time.
All I/O is done by reading or writing files, because all peripheral I/O devices, even a user's terminal, are files in the file system. Each supported device has an entry in the file system hierarchy, so that device names have the same structure as filenames, and the same protection mechanisms work on both devices and files.
A file is an ordered set of bytes of data on a I/O-device. The size of the file on input is determined by an end-of-file condition dependent on device-specific characteristics. The size of a regular file is determined by the position and number of bytes written on it, no predetermination of the size of a file is necessary or possible.
Besides the traditionally available devices, names exist for disk devices regarded as physical units outside the file system, and for absolutely addressed memory. The most important device in practice is the user's terminal. Treating a communication-device in the same way as any file by using the same I/O calls make it easy to redirect the input and output of commands from the terminal to another file; although, some differences are inevitable. For example, UNIX System V ordinarily treats terminal input in units of lines because character-erase and line-delete processing cannot be completed until a full line is typed. Programs trying to read some large number of bytes from a terminal must wait until a full line is typed, and then may be notified that some smaller number of bytes were actually read. All programs must prepare for this eventuality in any case, because a read from any disk file returns fewer bytes than requested when it reaches the end of the file. Ordinarily, reads from a terminal are fully compatible with reads from a disk file.