summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/scbuf_8c-source.html
diff options
context:
space:
mode:
authorhunt <hunt>2005-03-29 18:07:58 +0000
committerhunt <hunt>2005-03-29 18:07:58 +0000
commite32551b18f4560056d2d482f5e1505b1b98fa82a (patch)
tree4e9e07a9b46a4fd5dea27732571cbb04c0ef5dee /runtime/docs/html/scbuf_8c-source.html
parent13b35bb112459702e7371ecc89d7deb789818a86 (diff)
downloadsystemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.tar.gz
systemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.tar.xz
systemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.zip
*** empty log message ***
Diffstat (limited to 'runtime/docs/html/scbuf_8c-source.html')
-rw-r--r--runtime/docs/html/scbuf_8c-source.html79
1 files changed, 79 insertions, 0 deletions
diff --git a/runtime/docs/html/scbuf_8c-source.html b/runtime/docs/html/scbuf_8c-source.html
new file mode 100644
index 00000000..a9e9ddc8
--- /dev/null
+++ b/runtime/docs/html/scbuf_8c-source.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>SystemTap: scbuf.c Source File</title>
+<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="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>scbuf.c</h1><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _SCBUF_C_</span>
+00002 <span class="preprocessor"></span><span class="preprocessor">#define _SCBUF_C_</span>
+00003 <span class="preprocessor"></span>
+00004 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span>
+00005 <span class="comment">/** @file scbuf.c</span>
+00006 <span class="comment"> * @addtogroup scbuf Scratch Buffer</span>
+00007 <span class="comment"> * Scratch Buffer Functions.</span>
+00008 <span class="comment"> * The scratch buffer is for collecting output before storing in a map,</span>
+00009 <span class="comment"> * printing, etc. This is a per-cpu static buffer. It is necessary because </span>
+00010 <span class="comment"> * of the limited stack space available in the kernel.</span>
+00011 <span class="comment"> * @{</span>
+00012 <span class="comment"> */</span>
+00013 <span class="comment"></span>
+00014 <span class="comment">/** Maximum size of buffer, not including terminating NULL */</span>
+<a name="l00015"></a><a class="code" href="group__scbuf.html#ga6">00015</a> <span class="preprocessor">#define STP_BUF_LEN 8191</span>
+00016 <span class="preprocessor"></span><span class="comment"></span>
+00017 <span class="comment">/** Scratch buffer for printing, building strings, etc */</span>
+<a name="l00018"></a><a class="code" href="group__scbuf.html#ga0">00018</a> <span class="keywordtype">char</span> <a class="code" href="group__scbuf.html#ga0">_stp_scbuf</a>[<a class="code" href="group__scbuf.html#ga6">STP_BUF_LEN</a>+1];
+00019 <span class="keyword">static</span> <span class="keywordtype">int</span> _stp_scbuf_len = <a class="code" href="group__scbuf.html#ga6">STP_BUF_LEN</a>;
+00020 <span class="comment"></span>
+00021 <span class="comment">/** Sprint into the scratch buffer.</span>
+00022 <span class="comment"> * Like printf, except output goes into #_stp_scbuf,</span>
+00023 <span class="comment"> * which will contain the null-terminated output.</span>
+00024 <span class="comment"> * Safe because overflowing #_stp_scbuf is not allowed.</span>
+00025 <span class="comment"> * Size is limited by length of scratch buffer, STP_BUF_LEN.</span>
+00026 <span class="comment"> *</span>
+00027 <span class="comment"> * @param fmt A printf-style format string followed by a </span>
+00028 <span class="comment"> * variable number of args.</span>
+00029 <span class="comment"> * @sa _stp_scbuf_clear</span>
+00030 <span class="comment"> */</span>
+00031
+<a name="l00032"></a><a class="code" href="group__scbuf.html#ga2">00032</a> <span class="keywordtype">void</span> <a class="code" href="group__scbuf.html#ga2">_stp_sprint</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
+00033 {
+00034 <span class="keywordtype">int</span> num;
+00035 va_list args;
+00036 <span class="keywordtype">char</span> *buf = <a class="code" href="group__scbuf.html#ga0">_stp_scbuf</a> + <a class="code" href="group__scbuf.html#ga6">STP_BUF_LEN</a> - _stp_scbuf_len;
+00037 va_start(args, fmt);
+00038 num = vscnprintf(buf, _stp_scbuf_len, fmt, args);
+00039 va_end(args);
+00040 <span class="keywordflow">if</span> (num &gt; 0)
+00041 _stp_scbuf_len -= num;
+00042 }
+00043
+00044 <span class="keywordtype">void</span> _stp_sprint_str (<span class="keyword">const</span> <span class="keywordtype">char</span> *str)
+00045 {
+00046 <span class="keywordtype">char</span> *buf = <a class="code" href="group__scbuf.html#ga0">_stp_scbuf</a> + <a class="code" href="group__scbuf.html#ga6">STP_BUF_LEN</a> - _stp_scbuf_len;
+00047 <span class="keywordtype">int</span> num = strlen (str);
+00048 <span class="keywordflow">if</span> (num &gt; _stp_scbuf_len)
+00049 num = _stp_scbuf_len;
+00050 strncpy (buf, str, num);
+00051 _stp_scbuf_len -= num;
+00052 }
+00053 <span class="comment"></span>
+00054 <span class="comment">/** Clear the scratch buffer.</span>
+00055 <span class="comment"> * Output from _stp_sprint() will accumulate in the buffer</span>
+00056 <span class="comment"> * until this is called.</span>
+00057 <span class="comment"> */</span>
+00058
+<a name="l00059"></a><a class="code" href="group__scbuf.html#ga4">00059</a> <span class="keywordtype">void</span> _stp_scbuf_clear (<span class="keywordtype">void</span>)
+00060 {
+00061 _stp_scbuf_len = <a class="code" href="group__scbuf.html#ga6">STP_BUF_LEN</a>;
+00062 <a class="code" href="group__scbuf.html#ga0">_stp_scbuf</a>[0] = 0;
+00063 }
+00064
+00065 <span class="keyword">static</span> <span class="keywordtype">char</span> *_stp_scbuf_cur (<span class="keywordtype">void</span>)
+00066 {
+00067 <span class="keywordflow">return</span> <a class="code" href="group__scbuf.html#ga0">_stp_scbuf</a> + <a class="code" href="group__scbuf.html#ga6">STP_BUF_LEN</a> - _stp_scbuf_len;
+00068 }
+00069 <span class="comment"></span>
+00070 <span class="comment">/** @} */</span>
+00071 <span class="preprocessor">#endif </span><span class="comment">/* _SCBUF_C_ */</span>
+</pre></div></body></html>