summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/io_8c-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/docs/html/io_8c-source.html')
-rw-r--r--runtime/docs/html/io_8c-source.html195
1 files changed, 68 insertions, 127 deletions
diff --git a/runtime/docs/html/io_8c-source.html b/runtime/docs/html/io_8c-source.html
index c241bba1..064ef3f8 100644
--- a/runtime/docs/html/io_8c-source.html
+++ b/runtime/docs/html/io_8c-source.html
@@ -4,130 +4,71 @@
<link href="doxygen.css" rel="stylesheet" type="text/css">
</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>io.c</h1><a href="io_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 io.c</span>
-00003 <span class="comment"> * @brief I/O functions</span>
-00004 <span class="comment"> */</span>
-00005 <span class="comment"></span>
-00006 <span class="comment">/** Logs data.</span>
-00007 <span class="comment"> * This function is compatible with printk. In fact it currently</span>
-00008 <span class="comment"> * sends all output to vprintk, after sending "STP: ". This allows</span>
-00009 <span class="comment"> * us to easily detect SystemTap output in the log file.</span>
-00010 <span class="comment"> *</span>
-00011 <span class="comment"> * @param fmt A variable number of args.</span>
-00012 <span class="comment"> * @bug Lines are limited in length by printk buffer.</span>
-00013 <span class="comment"> * @todo Needs replaced with something much faster that does not</span>
-00014 <span class="comment"> * use the system log.</span>
-00015 <span class="comment"> */</span>
-<a name="l00016"></a><a class="code" href="io_8c.html#a4">00016</a> <span class="keywordtype">void</span> <a class="code" href="io_8c.html#a4">dlog</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
-00017 {
-00018 va_list args;
-00019 printk(<span class="stringliteral">"STP: "</span>);
-00020 va_start(args, fmt);
-00021 vprintk(fmt, args);
-00022 va_end(args);
-00023 }
-00024
-00025 <span class="comment"></span>
-00026 <span class="comment">/** Lookup symbol.</span>
-00027 <span class="comment"> * This simply calls the kernel function kallsyms_lookup().</span>
-00028 <span class="comment"> * That function is not exported, so this workaround is required.</span>
-00029 <span class="comment"> * See the kernel source, kernel/kallsyms.c for more information.</span>
-00030 <span class="comment"> */</span>
-<a name="l00031"></a><a class="code" href="io_8c.html#a1">00031</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * (*_stp_kallsyms_lookup)(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr,
-00032 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *symbolsize,
-00033 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *offset,
-00034 <span class="keywordtype">char</span> **modname, <span class="keywordtype">char</span> *namebuf)=(<span class="keywordtype">void</span> *)KALLSYMS_LOOKUP;
-00035
-00036
-00037 <span class="preprocessor">#define STP_BUF_LEN 8191</span>
-00038 <span class="preprocessor"></span><span class="comment"></span>
-00039 <span class="comment">/** Static buffer for printing */</span>
-<a name="l00040"></a><a class="code" href="io_8c.html#a2">00040</a> <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="io_8c.html#a2">_stp_pbuf</a>[STP_BUF_LEN+1];
-00041 <span class="keyword">static</span> <span class="keywordtype">int</span> _stp_pbuf_len = STP_BUF_LEN;
-00042 <span class="comment"></span>
-00043 <span class="comment">/** Print into the print buffer.</span>
-00044 <span class="comment"> * Like printf, except output goes into _stp_pbuf,</span>
-00045 <span class="comment"> * which will contain the null-terminated output.</span>
-00046 <span class="comment"> * Safe because overflowing _stp_pbuf is not allowed.</span>
-00047 <span class="comment"> * Size is limited by length of print buffer.</span>
-00048 <span class="comment"> *</span>
-00049 <span class="comment"> * @param fmt A variable number of args.</span>
-00050 <span class="comment"> * @note Formatting output should never be done within</span>
-00051 <span class="comment"> * a probe. Use at module exit time.</span>
-00052 <span class="comment"> * @sa _stp_print_buf_init</span>
-00053 <span class="comment"> */</span>
-00054
-<a name="l00055"></a><a class="code" href="io_8c.html#a5">00055</a> <span class="keywordtype">void</span> <a class="code" href="io_8c.html#a5">_stp_print_buf</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
-00056 {
-00057 <span class="keywordtype">int</span> num;
-00058 va_list args;
-00059 <span class="keywordtype">char</span> *buf = <a class="code" href="io_8c.html#a2">_stp_pbuf</a> + STP_BUF_LEN - _stp_pbuf_len;
-00060 va_start(args, fmt);
-00061 num = vscnprintf(buf, _stp_pbuf_len, fmt, args);
-00062 va_end(args);
-00063 <span class="keywordflow">if</span> (num &gt; 0)
-00064 _stp_pbuf_len -= num;
-00065 }
-00066 <span class="comment"></span>
-00067 <span class="comment">/** Clear the print buffer.</span>
-00068 <span class="comment"> * Output from _stp_print_buf() will accumulate in the buffer</span>
-00069 <span class="comment"> * until this is called.</span>
-00070 <span class="comment"> */</span>
-00071
-<a name="l00072"></a><a class="code" href="io_8c.html#a6">00072</a> <span class="keywordtype">void</span> <a class="code" href="io_8c.html#a6">_stp_print_buf_init</a> (<span class="keywordtype">void</span>)
-00073 {
-00074 _stp_pbuf_len = STP_BUF_LEN;
-00075 <a class="code" href="io_8c.html#a2">_stp_pbuf</a>[0] = 0;
-00076 }
-00077 <span class="comment"></span>
-00078 <span class="comment">/** Print addresses symbolically into the print buffer.</span>
-00079 <span class="comment"> * @param fmt A variable number of args.</span>
-00080 <span class="comment"> * @param address The address to lookup.</span>
-00081 <span class="comment"> * @note Formatting output should never be done within</span>
-00082 <span class="comment"> * a probe. Use at module exit time.</span>
-00083 <span class="comment"> */</span>
-00084
-<a name="l00085"></a><a class="code" href="io_8c.html#a7">00085</a> <span class="keywordtype">void</span> <a class="code" href="io_8c.html#a7">_stp_print_symbol</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> address)
-00086 {
-00087 <span class="keywordtype">char</span> *modname;
-00088 <span class="keyword">const</span> <span class="keywordtype">char</span> *name;
-00089 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> offset, size;
-00090 <span class="keywordtype">char</span> namebuf[KSYM_NAME_LEN+1];
-00091
-00092 name = <a class="code" href="io_8c.html#a1">_stp_kallsyms_lookup</a>(address, &amp;size, &amp;offset, &amp;modname, namebuf);
-00093
-00094 <span class="keywordflow">if</span> (!name)
-00095 <a class="code" href="io_8c.html#a5">_stp_print_buf</a>(<span class="stringliteral">"0x%lx"</span>, address);
-00096 <span class="keywordflow">else</span> {
-00097 <span class="keywordflow">if</span> (modname)
-00098 <a class="code" href="io_8c.html#a5">_stp_print_buf</a>(<span class="stringliteral">"%s+%#lx/%#lx [%s]"</span>, name, offset,
-00099 size, modname);
-00100 <span class="keywordflow">else</span>
-00101 <a class="code" href="io_8c.html#a5">_stp_print_buf</a>(<span class="stringliteral">"%s+%#lx/%#lx"</span>, name, offset, size);
-00102 }
-00103 }
-00104 <span class="comment"></span>
-00105 <span class="comment">/** Get the current return address.</span>
-00106 <span class="comment"> * Call from kprobes (not jprobes).</span>
-00107 <span class="comment"> * @param regs The pt_regs saved by the kprobe.</span>
-00108 <span class="comment"> * @return The return address saved in esp or rsp.</span>
-00109 <span class="comment"> * @note i386 and x86_64 only.</span>
-00110 <span class="comment"> */</span>
-00111
-<a name="l00112"></a><a class="code" href="io_8c.html#a8">00112</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="io_8c.html#a8">cur_ret_addr</a> (<span class="keyword">struct</span> pt_regs *regs)
-00113 {
-00114 <span class="preprocessor">#ifdef __x86_64__</span>
-00115 <span class="preprocessor"></span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *ra = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)regs-&gt;rsp;
-00116 <span class="preprocessor">#else</span>
-00117 <span class="preprocessor"></span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *ra = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)regs-&gt;esp;
-00118 <span class="preprocessor">#endif</span>
-00119 <span class="preprocessor"></span> <span class="keywordflow">if</span> (ra)
-00120 <span class="keywordflow">return</span> *ra;
-00121 <span class="keywordflow">else</span>
-00122 <span class="keywordflow">return</span> 0;
-00123 }
-</pre></div><hr size="1"><address style="align: right;"><small>
-Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
-</html>
+<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</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>io.c</h1><a href="io_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _IO_C_</span>
+00002 <span class="preprocessor"></span><span class="preprocessor">#define _IO_C_</span>
+00003 <span class="preprocessor"></span>
+00004 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span>
+00005 <span class="comment">/** @file io.c</span>
+00006 <span class="comment"> * @brief I/O functions</span>
+00007 <span class="comment"> */</span><span class="comment"></span>
+00008 <span class="comment">/** @addtogroup io I/O</span>
+00009 <span class="comment"> * I/O functions</span>
+00010 <span class="comment"> * @{</span>
+00011 <span class="comment"> */</span>
+00012 <span class="comment"></span>
+00013 <span class="comment">/** Logs Data.</span>
+00014 <span class="comment"> * This function is compatible with printk. In fact it currently</span>
+00015 <span class="comment"> * sends all output to vprintk, after sending "STP: ". This allows</span>
+00016 <span class="comment"> * us to easily detect SystemTap output in the log file. </span>
+00017 <span class="comment"> *</span>
+00018 <span class="comment"> * @param fmt A variable number of args.</span>
+00019 <span class="comment"> * @bug Lines are limited in length by printk buffer. If there is</span>
+00020 <span class="comment"> * no newline in the format string, then other syslog output could</span>
+00021 <span class="comment"> * get appended to the SystemTap line.</span>
+00022 <span class="comment"> * @todo Either deprecate or redefine this as a way to log debug or </span>
+00023 <span class="comment"> * status messages, separate from the normal program output.</span>
+00024 <span class="comment"> */</span>
+<a name="l00025"></a><a class="code" href="group__io.html#ga0">00025</a> <span class="keywordtype">void</span> <a class="code" href="group__io.html#ga0">dlog</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
+00026 {
+00027 va_list args;
+00028 printk(<span class="stringliteral">"STP: "</span>);
+00029 va_start(args, fmt);
+00030 vprintk(fmt, args);
+00031 va_end(args);
+00032 }
+00033 <span class="comment"></span>
+00034 <span class="comment">/** Prints to the trace buffer.</span>
+00035 <span class="comment"> * This function uses the same formatting as printk. It currently</span>
+00036 <span class="comment"> * writes to the system log. </span>
+00037 <span class="comment"> *</span>
+00038 <span class="comment"> * @param fmt A variable number of args.</span>
+00039 <span class="comment"> * @todo Needs replaced with something much faster that does not</span>
+00040 <span class="comment"> * use the system log.</span>
+00041 <span class="comment"> */</span>
+00042
+<a name="l00043"></a><a class="code" href="group__io.html#ga1">00043</a> <span class="keywordtype">void</span> <a class="code" href="group__io.html#ga1">_stp_print</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
+00044 {
+00045 va_list args;
+00046 va_start(args, fmt);
+00047 vprintk(fmt, args);
+00048 va_end(args);
+00049 }
+00050 <span class="comment"></span>
+00051 <span class="comment">/** Prints to the trace buffer.</span>
+00052 <span class="comment"> * This function will write a string to the trace buffer. It currently</span>
+00053 <span class="comment"> * writes to the system log. </span>
+00054 <span class="comment"> *</span>
+00055 <span class="comment"> * @param str String.</span>
+00056 <span class="comment"> * @todo Needs replaced with something much faster that does not</span>
+00057 <span class="comment"> * use the system log.</span>
+00058 <span class="comment"> */</span>
+00059
+<a name="l00060"></a><a class="code" href="group__io.html#ga2">00060</a> <span class="keywordtype">void</span> <a class="code" href="group__io.html#ga2">_stp_print_str</a> (<span class="keywordtype">char</span> *str)
+00061 {
+00062 printk (<span class="stringliteral">"%s"</span>, str);
+00063 }
+00064 <span class="comment"></span>
+00065 <span class="comment">/** @} */</span>
+00066 <span class="preprocessor">#endif </span><span class="comment">/* _IO_C_ */</span>
+</pre></div></body></html>