Simple Misc Driver - Problem with string copy to user

Bernd Petrovitsch bernd at petrovitsch.priv.at
Tue May 27 09:33:15 EDT 2014


Hi!

On Die, 2014-05-27 at 10:09 -0300, Lucas Tanure wrote:
> Wow, many thanks.
> So the read operation should return the total number of bytes, not a
> true/false int.

The syscall here (done by `head`) is read() ...

> I need to read more about this operations.

.. and the drivers .read function is called if the user-space calls
read() on the (opened) device.
This .read function returns
*) > 0 with the number of successfully read bytes
*) == 0 on end-of-file.
*) < 0 on errors. And these error codes are found on `man errno` and
   one just returns them as "-Exxxx".

[ Fullquote deleted ]

Kind regards,
	Bernd




More information about the Kernelnewbies mailing list