From: bforce1729 <bforce1729@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Need to know the size of data send from Kernel to USer Ap
Date: Tue, 24 Jul 2012 01:08:40 -0700 [thread overview]
Message-ID: <500E5808.1070607@gmail.com> (raw)
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
next reply other threads:[~2012-07-24 8:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 8:08 bforce1729 [this message]
2012-07-24 9:06 ` Need to know the size of data send from Kernel to USer Ap Ian Abbott
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=500E5808.1070607@gmail.com \
--to=bforce1729@gmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox