Create a UNIX Special Character File

Suppose I want to create, in the spirit of / dev / zero, the file / dev / seven, which generates the character "7" whenever it is read. How do I do something like this? Do I need to change the kernel?

+5
source share
3 answers

Yes, you need to create a driver for this special character device.

For linux, I suggest you read the Linux device drivers by Jonathan Corbe, Alessandro Rubini, and Greg Croa-Hartman. (Chapter 3 talks about char drivers, but read at least the first two chapters.)

+4
source

, fifo , 7, .

script, .

+1

Here is a short example of creating a device driver for Linux that can help you get started:

0
source

All Articles