Home >Operation and Maintenance >Linux Operation and Maintenance >What file is linux c
linux c is a character device file; a character device is a device that can be accessed like a byte stream. This feature is implemented by the character device driver; the character device driver usually must implement at least open, close, Read and write system calls.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
What is the file c in linux?
Character device.
A character (char) device is a device that can be accessed like a byte stream (similar to a file). This feature is implemented by the character device driver. Character device drivers usually implement at least the open, close, read, and write system calls.
Character terminal (/dev/console) and serial port (/dev/ttyS0 and similar devices) are two character devices, which can well illustrate the abstract concept of "stream".
Character devices can be accessed through file nodes, such as /dev/tty1 and /dev/lp0, etc. The only difference between these device files and ordinary files is that access to ordinary files can move the access location back and forth, while most character devices are a data channel that can only be accessed sequentially. However, there are also character devices that have data area characteristics that allow you to move the access location back and forth when accessing them. For example, framebuffer is such a device, and the app can use mmap or lseek to access the entire captured image.
Execute ls -l under /dev, you can see many created device nodes:
Character device file (type c), device The file has no file size, instead there are two numbers: major device number 5 and device number 1.
Linux file types (b, c, d, l, s, -)
Description | |
---|---|
Block devices are interface devices that provide system access to data, such as hard disks. | |
Character devices are interface devices for some serial ports, such as keyboards, mice, printers, and tty terminals. | |
Directory, similar to Windows folders. | |
Link file, similar to Windows shortcut. | |
Socket file (socket), used for communication between processes. | |
Files are divided into plain text files (ASCII) and binary files (binary). |
Description | |
---|---|
View file type |
linux video tutorial"
The above is the detailed content of What file is linux c. For more information, please follow other related articles on the PHP Chinese website!