Thread (6 messages) flat view 6 messages, 5 authors, 2016-10-05

Char device write repeating

From: Martin Kletzander <hidden>
Date: 2016-10-05 06:29:16

On Tue, Oct 04, 2016 at 05:05:57PM +0200, Greg KH wrote:
On Tue, Oct 04, 2016 at 10:58:16AM -0400, Kenneth Adam Miller wrote:
quoted
I have a character device that I am calling write on and which is succeeding,
but which is repeatedly executing. I have hard coded the return value to one,
Correct me if I'm wrong, I'm just a self-thought newbie, but this ^^
sounds to me like the problem.  Because the write should return how many
bytes were written (or error), the function is being called until it's
been all written.  If you just want to be called once and you don't care
what the data are (which is the weird thing in the first place), I think
you should return the length you got as an argument.
quoted
so I don't think the userland standard library is retrying but I could be
wrong. Can anybody tell me why write would be re-executed by the kernel and how
to fix it? I dont actually copy_from_user, I just need this in order to signal
kernel land.
Do you have a pointer to your code somewhere?  This is a very common bug
that people have...

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161005/f0fb88d5/attachment.bin 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help