All of lore.kernel.org
 help / color / mirror / Atom feed
From: bernd@petrovitsch.priv.at (Bernd Petrovitsch)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Simple Misc Driver - Problem with string copy to user
Date: Tue, 27 May 2014 15:33:15 +0200	[thread overview]
Message-ID: <1401197613.7926.8.camel@thorin> (raw)
In-Reply-To: <CAJyon0tAB+htm6oMbHF-YWS9XfLmiX=ZAjYzUyBC=TxcVhpQ4w@mail.gmail.com>

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

  reply	other threads:[~2014-05-27 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 12:48 Simple Misc Driver - Problem with string copy to user Lucas Tanure
2014-05-27 12:59 ` Bjørn Mork
2014-05-27 13:03   ` Lucas Tanure
2014-05-27 13:05     ` Bjørn Mork
2014-05-27 13:09       ` Lucas Tanure
2014-05-27 13:33         ` Bernd Petrovitsch [this message]
2014-05-28  0:27 ` Le Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401197613.7926.8.camel@thorin \
    --to=bernd@petrovitsch.priv.at \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.