<br><br><div class="gmail_quote">On Mon, Feb 11, 2013 at 5:25 PM, anish singh <span dir="ltr"><<a href="mailto:anish198519851985@gmail.com" target="_blank">anish198519851985@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br><br>On Mon, Feb 11, 2013 at 4:51 PM, पारस <<a href="mailto:beparas@gmail.com" target="_blank">beparas@gmail.com</a>> wrote:<br></div><div class="im">> Hi All,<br>><br>> To read/write data to user-space from kernel-space we use copy_from_user()<br>
> and copy_to_user() functions.<br>><br>> What is the use of these function?<br>> Why kernel can't directly access user address and read/write on to it?<br></div>what will happen if the user space process gets scheduled out while<br>
you were using it?<div class="im HOEnZb"><br></div></blockquote><div>copy_to/from_user should always be called from process context. So even if a process is scheduled out there is not impact, as when process schedule back in copying will resume to/from correct page.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im HOEnZb">> Can any one explain why kernel can't directly access the user-space address.<br>
><br>> Thanks<br>><br>><br></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br><br>
</div></div><br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br>