public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Need to know the size of data send from Kernel to USer Ap
@ 2012-07-24  8:08 bforce1729
  2012-07-24  9:06 ` Ian Abbott
  0 siblings, 1 reply; 2+ messages in thread
From: bforce1729 @ 2012-07-24  8:08 UTC (permalink / raw)
  To: linux-kernel

Hi,

I am new to kernel programming so can anyone point me to the right 
forum/reply for the question below.

I would like to implement a character device and using a node of type 
character  read and write data. However I am not sure of the length of 
data from kernel which a user app will receive, so I would like to code 
safely. If the data exceeds the application gets killed.
Any idea or API to perform the task of knowing the data length when 
passing data to and fro from kernel to user level would be appreciated.

Kernel code:

                 copy_to_user(buff, kernel_msg, strlen(kernel_msg));

User App:
                 fd=open("./my_device",O_RDONLY);
ret=read(fd,buff,strlen(buf));                        //How can I know 
the size of buff, which would be sent/filled from kernel???

Regards
bforce

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-24  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24  8:08 Need to know the size of data send from Kernel to USer Ap bforce1729
2012-07-24  9:06 ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox