Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 2159

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>copy_[to/from]_user() / get_user() / put_user() include/asm/uaccess.h</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Unreliable Guide To Hacking The Linux Kernel" /><link rel="up" href="ch06.html" title="Chapter&#160;6.&#160;Common Routines" /><link rel="prev" href="ch06.html" title="Chapter&#160;6.&#160;Common Routines" /><link rel="next" href="ch06s03.html" title="kmalloc()/kfree() include/linux/slab.h" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
    <code class="function">copy_[to/from]_user()</code>
    /
    <code class="function">get_user()</code>
    /
    <code class="function">put_user()</code>
    <code class="filename">include/asm/uaccess.h</code>
   </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;6.&#160;Common Routines</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch06s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="copy_[to/from]_user() / get_user() / put_user() include/asm/uaccess.h"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="routines-copy"></a>
    <code class="function">copy_[to/from]_user()</code>
    /
    <code class="function">get_user()</code>
    /
    <code class="function">put_user()</code>
    <code class="filename">include/asm/uaccess.h</code>
   </h2></div></div></div><p>
    <span class="emphasis"><em>[SLEEPS]</em></span>
   </p><p>
    <code class="function">put_user()</code> and <code class="function">get_user()</code>
    are used to get and put single values (such as an int, char, or
    long) from and to userspace.  A pointer into userspace should
    never be simply dereferenced: data should be copied using these
    routines.  Both return <code class="constant">-EFAULT</code> or 0.
   </p><p>
    <code class="function">copy_to_user()</code> and
    <code class="function">copy_from_user()</code> are more general: they copy
    an arbitrary amount of data to and from userspace.
    </p><div class="caution" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p>
      Unlike <code class="function">put_user()</code> and
      <code class="function">get_user()</code>, they return the amount of
      uncopied data (ie. <span class="returnvalue">0</span> still means
      success).
     </p></div><p>
    [Yes, this moronic interface makes me cringe.  The flamewar comes up every year or so. --RR.]
   </p><p>
    The functions may sleep implicitly. This should never be called
    outside user context (it makes no sense), with interrupts
    disabled, or a spinlock held.
   </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch06s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;6.&#160;Common Routines&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<code class="function">kmalloc()</code>/<code class="function">kfree()</code>
    <code class="filename">include/linux/slab.h</code></td></tr></table></div></body></html>