summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/copy_8c-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/docs/html/copy_8c-source.html')
-rw-r--r--runtime/docs/html/copy_8c-source.html278
1 files changed, 141 insertions, 137 deletions
diff --git a/runtime/docs/html/copy_8c-source.html b/runtime/docs/html/copy_8c-source.html
index bab47938..3456380c 100644
--- a/runtime/docs/html/copy_8c-source.html
+++ b/runtime/docs/html/copy_8c-source.html
@@ -5,143 +5,147 @@
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
-<h1>copy.c</h1><div class="fragment"><pre class="fragment">00001 <span class="keywordtype">long</span> _stp_strncpy_from_user(<span class="keywordtype">char</span> *dst, <span class="keyword">const</span> <span class="keywordtype">char</span> __user *src, <span class="keywordtype">long</span> count);
-00002 <span class="comment">//static long __stp_strncpy_from_user(char *dst, const char __user *src, long count);</span>
-00003
-00004 <span class="preprocessor">#if defined (__i386__)</span>
-00005 <span class="preprocessor"></span><span class="preprocessor">#define __stp_strncpy_from_user(dst,src,count,res) \</span>
-00006 <span class="preprocessor">do { \</span>
-00007 <span class="preprocessor"> int __d0, __d1, __d2; \</span>
-00008 <span class="preprocessor"> __asm__ __volatile__( \</span>
-00009 <span class="preprocessor"> " testl %1,%1\n" \</span>
-00010 <span class="preprocessor"> " jz 2f\n" \</span>
-00011 <span class="preprocessor"> "0: lodsb\n" \</span>
-00012 <span class="preprocessor"> " stosb\n" \</span>
-00013 <span class="preprocessor"> " testb %%al,%%al\n" \</span>
-00014 <span class="preprocessor"> " jz 1f\n" \</span>
-00015 <span class="preprocessor"> " decl %1\n" \</span>
-00016 <span class="preprocessor"> " jnz 0b\n" \</span>
-00017 <span class="preprocessor"> "1: subl %1,%0\n" \</span>
-00018 <span class="preprocessor"> "2:\n" \</span>
-00019 <span class="preprocessor"> ".section .fixup,\"ax\"\n" \</span>
-00020 <span class="preprocessor"> "3: movl %5,%0\n" \</span>
-00021 <span class="preprocessor"> " jmp 2b\n" \</span>
-00022 <span class="preprocessor"> ".previous\n" \</span>
-00023 <span class="preprocessor"> ".section __ex_table,\"a\"\n" \</span>
-00024 <span class="preprocessor"> " .align 4\n" \</span>
-00025 <span class="preprocessor"> " .long 0b,3b\n" \</span>
-00026 <span class="preprocessor"> ".previous" \</span>
-00027 <span class="preprocessor"> : "=d"(res), "=c"(count), "=&amp;a" (__d0), "=&amp;S" (__d1), \</span>
-00028 <span class="preprocessor"> "=&amp;D" (__d2) \</span>
-00029 <span class="preprocessor"> : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \</span>
-00030 <span class="preprocessor"> : "memory"); \</span>
-00031 <span class="preprocessor">} while (0)</span>
-00032 <span class="preprocessor"></span><span class="preprocessor">#elif defined (__x86_64__)</span>
-00033 <span class="preprocessor"></span><span class="preprocessor">#define __stp_strncpy_from_user(dst,src,count,res) \</span>
-00034 <span class="preprocessor">do { \</span>
-00035 <span class="preprocessor"> long __d0, __d1, __d2; \</span>
-00036 <span class="preprocessor"> __asm__ __volatile__( \</span>
-00037 <span class="preprocessor"> " testq %1,%1\n" \</span>
-00038 <span class="preprocessor"> " jz 2f\n" \</span>
-00039 <span class="preprocessor"> "0: lodsb\n" \</span>
-00040 <span class="preprocessor"> " stosb\n" \</span>
-00041 <span class="preprocessor"> " testb %%al,%%al\n" \</span>
-00042 <span class="preprocessor"> " jz 1f\n" \</span>
-00043 <span class="preprocessor"> " decq %1\n" \</span>
-00044 <span class="preprocessor"> " jnz 0b\n" \</span>
-00045 <span class="preprocessor"> "1: subq %1,%0\n" \</span>
-00046 <span class="preprocessor"> "2:\n" \</span>
-00047 <span class="preprocessor"> ".section .fixup,\"ax\"\n" \</span>
-00048 <span class="preprocessor"> "3: movq %5,%0\n" \</span>
-00049 <span class="preprocessor"> " jmp 2b\n" \</span>
-00050 <span class="preprocessor"> ".previous\n" \</span>
-00051 <span class="preprocessor"> ".section __ex_table,\"a\"\n" \</span>
-00052 <span class="preprocessor"> " .align 8\n" \</span>
-00053 <span class="preprocessor"> " .quad 0b,3b\n" \</span>
-00054 <span class="preprocessor"> ".previous" \</span>
-00055 <span class="preprocessor"> : "=r"(res), "=c"(count), "=&amp;a" (__d0), "=&amp;S" (__d1), \</span>
-00056 <span class="preprocessor"> "=&amp;D" (__d2) \</span>
-00057 <span class="preprocessor"> : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \</span>
-00058 <span class="preprocessor"> : "memory"); \</span>
-00059 <span class="preprocessor">} while (0)</span>
-00060 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
-00061 <span class="preprocessor"></span><span class="comment"></span>
-00062 <span class="comment">/** Copy a NULL-terminated string from userspace.</span>
-00063 <span class="comment"> * On success, returns the length of the string (not including the trailing</span>
-00064 <span class="comment"> * NULL).</span>
-00065 <span class="comment"> *</span>
-00066 <span class="comment"> * If access to userspace fails, returns -EFAULT (some data may have been</span>
-00067 <span class="comment"> * copied).</span>
-00068 <span class="comment"> * @param dst Destination address, in kernel space. This buffer must be at</span>
-00069 <span class="comment"> * least &lt;i&gt;count&lt;/i&gt; bytes long.</span>
-00070 <span class="comment"> * @param src Source address, in user space.</span>
-00071 <span class="comment"> * @param count Maximum number of bytes to copy, including the trailing NULL.</span>
-00072 <span class="comment"> * </span>
-00073 <span class="comment"> * If &lt;i&gt;count&lt;/i&gt; is smaller than the length of the string, copies </span>
-00074 <span class="comment"> * &lt;i&gt;count&lt;/i&gt; bytes and returns &lt;i&gt;count&lt;/i&gt;.</span>
-00075 <span class="comment"> */</span>
-00076
-00077
-00078 <span class="keywordtype">long</span>
-00079 _stp_strncpy_from_user(<span class="keywordtype">char</span> *dst, <span class="keyword">const</span> <span class="keywordtype">char</span> __user *src, <span class="keywordtype">long</span> count)
-00080 {
-00081 <span class="keywordtype">long</span> res;
-00082 __stp_strncpy_from_user(dst, src, count, res);
-00083 <span class="keywordflow">return</span> res;
-00084 }
-00085 <span class="comment"></span>
-00086 <span class="comment">/** Copy a block of data from user space.</span>
-00087 <span class="comment"> *</span>
-00088 <span class="comment"> * If some data could not be copied, this function will pad the copied</span>
-00089 <span class="comment"> * data to the requested size using zero bytes.</span>
-00090 <span class="comment"></span>
-00091 <span class="comment"> * @param dst Destination address, in kernel space.</span>
-00092 <span class="comment"> * @param src Source address, in user space.</span>
-00093 <span class="comment"> * @param count Number of bytes to copy.</span>
-00094 <span class="comment"> * @return number of bytes that could not be copied. On success, </span>
-00095 <span class="comment"> * this will be zero.</span>
-00096 <span class="comment"> *</span>
-00097 <span class="comment"> */</span>
-00098
-00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keyword">inline</span>
-00100 _stp_copy_from_user (<span class="keywordtype">char</span> *dst, <span class="keyword">const</span> <span class="keywordtype">char</span> __user *src, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> count)
-00101 {
-00102 <span class="keywordflow">return</span> __copy_from_user_inatomic(dst, src, count);
-00103 }
-00104 <span class="comment"></span>
-00105 <span class="comment">/** Copy an argv from user space to a List.</span>
-00106 <span class="comment"> *</span>
-00107 <span class="comment"> * @param list A list.</span>
-00108 <span class="comment"> * @param argv Source argv, in user space.</span>
-00109 <span class="comment"> * @return number of elements in &lt;i&gt;list&lt;/i&gt;</span>
+<h1>copy.c</h1><a href="copy_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span>
+00002 <span class="comment">/** @file copy.c</span>
+00003 <span class="comment"> * @brief Functions to copy from user space.</span>
+00004 <span class="comment"> */</span>
+00005
+00006 <span class="keywordtype">long</span> <a class="code" href="copy_8c.html#a0">_stp_strncpy_from_user</a>(<span class="keywordtype">char</span> *dst, <span class="keyword">const</span> <span class="keywordtype">char</span> __user *src, <span class="keywordtype">long</span> count);
+00007 <span class="comment">//static long __stp_strncpy_from_user(char *dst, const char __user *src, long count);</span>
+00008
+00009 <span class="preprocessor">#if defined (__i386__)</span>
+00010 <span class="preprocessor"></span><span class="preprocessor">#define __stp_strncpy_from_user(dst,src,count,res) \</span>
+00011 <span class="preprocessor">do { \</span>
+00012 <span class="preprocessor"> int __d0, __d1, __d2; \</span>
+00013 <span class="preprocessor"> __asm__ __volatile__( \</span>
+00014 <span class="preprocessor"> " testl %1,%1\n" \</span>
+00015 <span class="preprocessor"> " jz 2f\n" \</span>
+00016 <span class="preprocessor"> "0: lodsb\n" \</span>
+00017 <span class="preprocessor"> " stosb\n" \</span>
+00018 <span class="preprocessor"> " testb %%al,%%al\n" \</span>
+00019 <span class="preprocessor"> " jz 1f\n" \</span>
+00020 <span class="preprocessor"> " decl %1\n" \</span>
+00021 <span class="preprocessor"> " jnz 0b\n" \</span>
+00022 <span class="preprocessor"> "1: subl %1,%0\n" \</span>
+00023 <span class="preprocessor"> "2:\n" \</span>
+00024 <span class="preprocessor"> ".section .fixup,\"ax\"\n" \</span>
+00025 <span class="preprocessor"> "3: movl %5,%0\n" \</span>
+00026 <span class="preprocessor"> " jmp 2b\n" \</span>
+00027 <span class="preprocessor"> ".previous\n" \</span>
+00028 <span class="preprocessor"> ".section __ex_table,\"a\"\n" \</span>
+00029 <span class="preprocessor"> " .align 4\n" \</span>
+00030 <span class="preprocessor"> " .long 0b,3b\n" \</span>
+00031 <span class="preprocessor"> ".previous" \</span>
+00032 <span class="preprocessor"> : "=d"(res), "=c"(count), "=&amp;a" (__d0), "=&amp;S" (__d1), \</span>
+00033 <span class="preprocessor"> "=&amp;D" (__d2) \</span>
+00034 <span class="preprocessor"> : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \</span>
+00035 <span class="preprocessor"> : "memory"); \</span>
+00036 <span class="preprocessor">} while (0)</span>
+00037 <span class="preprocessor"></span><span class="preprocessor">#elif defined (__x86_64__)</span>
+00038 <span class="preprocessor"></span><span class="preprocessor">#define __stp_strncpy_from_user(dst,src,count,res) \</span>
+00039 <span class="preprocessor">do { \</span>
+00040 <span class="preprocessor"> long __d0, __d1, __d2; \</span>
+00041 <span class="preprocessor"> __asm__ __volatile__( \</span>
+00042 <span class="preprocessor"> " testq %1,%1\n" \</span>
+00043 <span class="preprocessor"> " jz 2f\n" \</span>
+00044 <span class="preprocessor"> "0: lodsb\n" \</span>
+00045 <span class="preprocessor"> " stosb\n" \</span>
+00046 <span class="preprocessor"> " testb %%al,%%al\n" \</span>
+00047 <span class="preprocessor"> " jz 1f\n" \</span>
+00048 <span class="preprocessor"> " decq %1\n" \</span>
+00049 <span class="preprocessor"> " jnz 0b\n" \</span>
+00050 <span class="preprocessor"> "1: subq %1,%0\n" \</span>
+00051 <span class="preprocessor"> "2:\n" \</span>
+00052 <span class="preprocessor"> ".section .fixup,\"ax\"\n" \</span>
+00053 <span class="preprocessor"> "3: movq %5,%0\n" \</span>
+00054 <span class="preprocessor"> " jmp 2b\n" \</span>
+00055 <span class="preprocessor"> ".previous\n" \</span>
+00056 <span class="preprocessor"> ".section __ex_table,\"a\"\n" \</span>
+00057 <span class="preprocessor"> " .align 8\n" \</span>
+00058 <span class="preprocessor"> " .quad 0b,3b\n" \</span>
+00059 <span class="preprocessor"> ".previous" \</span>
+00060 <span class="preprocessor"> : "=r"(res), "=c"(count), "=&amp;a" (__d0), "=&amp;S" (__d1), \</span>
+00061 <span class="preprocessor"> "=&amp;D" (__d2) \</span>
+00062 <span class="preprocessor"> : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \</span>
+00063 <span class="preprocessor"> : "memory"); \</span>
+00064 <span class="preprocessor">} while (0)</span>
+00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00066 <span class="preprocessor"></span><span class="comment"></span>
+00067 <span class="comment">/** Copy a NULL-terminated string from userspace.</span>
+00068 <span class="comment"> * On success, returns the length of the string (not including the trailing</span>
+00069 <span class="comment"> * NULL).</span>
+00070 <span class="comment"> *</span>
+00071 <span class="comment"> * If access to userspace fails, returns -EFAULT (some data may have been</span>
+00072 <span class="comment"> * copied).</span>
+00073 <span class="comment"> * @param dst Destination address, in kernel space. This buffer must be at</span>
+00074 <span class="comment"> * least &lt;i&gt;count&lt;/i&gt; bytes long.</span>
+00075 <span class="comment"> * @param src Source address, in user space.</span>
+00076 <span class="comment"> * @param count Maximum number of bytes to copy, including the trailing NULL.</span>
+00077 <span class="comment"> * </span>
+00078 <span class="comment"> * If &lt;i&gt;count&lt;/i&gt; is smaller than the length of the string, copies </span>
+00079 <span class="comment"> * &lt;i&gt;count&lt;/i&gt; bytes and returns &lt;i&gt;count&lt;/i&gt;.</span>
+00080 <span class="comment"> */</span>
+00081
+00082 <span class="keywordtype">long</span>
+<a name="l00083"></a><a class="code" href="copy_8c.html#a0">00083</a> <a class="code" href="copy_8c.html#a0">_stp_strncpy_from_user</a>(<span class="keywordtype">char</span> *dst, <span class="keyword">const</span> <span class="keywordtype">char</span> __user *src, <span class="keywordtype">long</span> count)
+00084 {
+00085 <span class="keywordtype">long</span> res;
+00086 __stp_strncpy_from_user(dst, src, count, res);
+00087 <span class="keywordflow">return</span> res;
+00088 }
+00089 <span class="comment"></span>
+00090 <span class="comment">/** Copy a block of data from user space.</span>
+00091 <span class="comment"> *</span>
+00092 <span class="comment"> * If some data could not be copied, this function will pad the copied</span>
+00093 <span class="comment"> * data to the requested size using zero bytes.</span>
+00094 <span class="comment"></span>
+00095 <span class="comment"> * @param dst Destination address, in kernel space.</span>
+00096 <span class="comment"> * @param src Source address, in user space.</span>
+00097 <span class="comment"> * @param count Number of bytes to copy.</span>
+00098 <span class="comment"> * @return number of bytes that could not be copied. On success, </span>
+00099 <span class="comment"> * this will be zero.</span>
+00100 <span class="comment"> *</span>
+00101 <span class="comment"> */</span>
+00102
+00103 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keyword">inline</span>
+<a name="l00104"></a><a class="code" href="copy_8c.html#a1">00104</a> <a class="code" href="copy_8c.html#a1">_stp_copy_from_user</a> (<span class="keywordtype">char</span> *dst, <span class="keyword">const</span> <span class="keywordtype">char</span> __user *src, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> count)
+00105 {
+00106 <span class="keywordflow">return</span> __copy_from_user_inatomic(dst, src, count);
+00107 }
+00108 <span class="comment"></span>
+00109 <span class="comment">/** Copy an argv from user space to a List.</span>
00110 <span class="comment"> *</span>
-00111 <span class="comment"> * @b Example:</span>
-00112 <span class="comment"> * @include argv.c</span>
-00113 <span class="comment"> */</span>
-00114
-00115 <span class="keywordtype">int</span> _stp_copy_argv_from_user (<a class="code" href="structmap__root.html">MAP</a> list, <span class="keywordtype">char</span> __user *__user *argv)
-00116 {
-00117 <span class="keywordtype">char</span> str[128];
-00118 <span class="keywordtype">char</span> __user *vstr;
-00119 <span class="keywordtype">int</span> len;
-00120
-00121 <span class="keywordflow">if</span> (argv)
-00122 argv++;
-00123
-00124 while (argv != NULL) {
-00125 <span class="keywordflow">if</span> (get_user (vstr, argv))
-00126 break;
-00127
-00128 if (vstr == NULL)
-00129 break;
-00130
-00131 len = _stp_strncpy_from_user(str, vstr, 128);
-00132 str[len] = 0;
-00133 _stp_list_add_str (list, str);
-00134 argv++;
-00135 }
-00136 return list-&gt;num;
-00137 }
+00111 <span class="comment"> * @param list A list.</span>
+00112 <span class="comment"> * @param argv Source argv, in user space.</span>
+00113 <span class="comment"> * @return number of elements in &lt;i&gt;list&lt;/i&gt;</span>
+00114 <span class="comment"> *</span>
+00115 <span class="comment"> * @b Example:</span>
+00116 <span class="comment"> * @include argv.c</span>
+00117 <span class="comment"> */</span>
+00118
+<a name="l00119"></a><a class="code" href="copy_8c.html#a2">00119</a> <span class="keywordtype">int</span> <a class="code" href="copy_8c.html#a2">_stp_copy_argv_from_user</a> (<a class="code" href="structmap__root.html">MAP</a> list, <span class="keywordtype">char</span> __user *__user *argv)
+00120 {
+00121 <span class="keywordtype">char</span> str[128];
+00122 <span class="keywordtype">char</span> __user *vstr;
+00123 <span class="keywordtype">int</span> len;
+00124
+00125 <span class="keywordflow">if</span> (argv)
+00126 argv++;
+00127
+00128 <span class="keywordflow">while</span> (argv != NULL) {
+00129 <span class="keywordflow">if</span> (get_user (vstr, argv))
+00130 <span class="keywordflow">break</span>;
+00131
+00132 <span class="keywordflow">if</span> (vstr == NULL)
+00133 <span class="keywordflow">break</span>;
+00134
+00135 len = <a class="code" href="copy_8c.html#a0">_stp_strncpy_from_user</a>(str, vstr, 128);
+00136 str[len] = 0;
+00137 <a class="code" href="map_8c.html#a27">_stp_list_add_str</a> (list, str);
+00138 argv++;
+00139 }
+00140 <span class="keywordflow">return</span> list-&gt;<a class="code" href="structmap__root.html#o2">num</a>;
+00141 }
</pre></div><hr size="1"><address style="align: right;"><small>
-Generated on Tue Mar 22 00:32:02 2005 for SystemTap.</small></body>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>