2

Let's consider the following (imaginary) device: a clock which takes 1 second to query, then returns the current time. We want to write a character device driver for it, which supports read operations only.

  • I believe non-blocking reads would not make sense for such a device, because we cannot cache the results of a read. Would you agree?
  • Is it allowed to only handle blocking reads? If so, what error code should non-blocking reads return? Or what other way do we have to specify that we don't support non-blocking operations?

I'd like to understand this better before I implement a character device driver for a real device. I'm interested in Linux, but I believe the answer is unlikely to be Linux-specific.

marcv81
  • 620
  • 2
  • 7
  • 15

0 Answers0