In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the mknod command in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!
The Linux common command mknod command is used to create character device files and block device files in Linux.
Mknod creates character device files and block device files
Syntax mknod (options) (parameters) option-Z: set the security context;-m: set the permission mode;-help: display help information;-- version: display version information. Parameter file name: the device file name to be created
Type: specifies the type of device file to create
Master equipment number: specify the main device number of the device file
Secondary number: specifies the secondary number of the device file.
Example ls-la / dev/ttyUSB* crw-rw-- 1 root dialout 188,0 2008-02-13 18:32 / dev/ttyUSB0 mknod / dev/ttyUSB32 c 18832 extended knowledge Linux device management is closely integrated with the file system, all kinds of devices are stored in the form of files in the / dev directory, called device files. Applications can open, close, read and write these device files, and complete the operation of the device, just like ordinary data files.
In order to manage these devices, the system numbers the equipment, and each equipment number is divided into the main equipment number and the secondary equipment number. The primary device number is used to distinguish between different types of devices, while the secondary device number is used to distinguish multiple devices of the same type. For commonly used equipment, Linux has a conventional numbering, such as the main setting number of the hard disk is 3.
Linux provides a unified operation function interface for all device files by using the data structure struct file_operations. This data structure includes the pointers of many operation functions, such as open (), close (), read () and write (), etc., but they operate in different ways because of the variety of peripherals. The members of the Struct file_operations structure are a series of interface functions, such as the read/write function for read / write and the ioctl for control.
Opening a file invokes the open operation in the file file_operations. Different types of files have different file_operations member functions, such as ordinary disk data files, the interface function completes the read and write operation of disk data blocks; for various device files, the final call of the respective driver of the Ihop O function for specific device operations. In this way, the application does not have to consider whether to operate a set-up or an ordinary file at all, but can be treated as a file, with a very clear and unified Imax O interface. So file_operations is the file-level IUnip O interface.
The above is all the contents of the article "how to use mknod commands in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.