Sample Header Ad - 728x90

May a character device only handle blocking I/O?

2 votes
0 answers
159 views
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.
Asked by marcv81 (618 rep)
Dec 25, 2020, 11:15 AM
Last activity: Dec 25, 2020, 11:20 AM