What file is linux c

藏色散人
Release: 2023-04-13 11:17:59
Original
3301 people have browsed it

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.

What file is linux c

#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:

What file is linux c

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, -)

##Linux file type description

File typeDescriptionbBlock devices are interface devices that provide system access to data, such as hard disks. cCharacter devices are interface devices for some serial ports, such as keyboards, mice, printers, and tty terminals. d Directory, similar to Windows folders. lLink file, similar to Windows shortcut. sSocket file (socket), used for communication between processes. - Files are divided into plain text files (ASCII) and binary files (binary).
##Command file filename
Description
View file type
## Recommended learning: "

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template