0

What happens when writing to a device driver?

For example:

echo "some text" > /proc/device_driver

I'm guessing that echo has a write-call that somehow invokes the write-function in the driver. What are the "steps" from the echo-function to the drivers write function?

1 Answers1

1

As explained in the The Linux Kernel Module Programming Guide (5.2. Read and Write a /proc File), the kernel calls a function associated with the driver during the driver's initialization to read the data from userspace into the kernel.

The echo program does not know anything special about the kernel; the kernel does all of the work.

Further reading:

Thomas Dickey
  • 76,765