From mboxrd@z Thu Jan 1 00:00:00 1970 From: bernd@petrovitsch.priv.at (Bernd Petrovitsch) Date: Tue, 27 May 2014 15:33:15 +0200 Subject: Simple Misc Driver - Problem with string copy to user In-Reply-To: References: <87ppizgywj.fsf@nemi.mork.no> <87lhtngymi.fsf@nemi.mork.no> Message-ID: <1401197613.7926.8.camel@thorin> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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