# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
-EXTRACT_STATIC = NO
+EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
/* -*- linux-c -*- */
+/** @file alloc.h
+ * @brief Memory allocation functions.
+ * @todo Should really be alloc.c for consistency.
+ */
enum errorcode { ERR_NONE=0, ERR_NO_MEM };
enum errorcode _stp_error = ERR_NONE;
+/* -*- linux-c -*- */
+/** @file copy.c
+ * @brief Functions to copy from user space.
+ */
+
long _stp_strncpy_from_user(char *dst, const char __user *src, long count);
//static long __stp_strncpy_from_user(char *dst, const char __user *src, long count);
* <i>count</i> bytes and returns <i>count</i>.
*/
-
long
_stp_strncpy_from_user(char *dst, const char __user *src, long count)
{
00052 <span class="comment"> * \link todo Click Here for Complete List \endlink</span>
00053 <span class="comment"> */</span>
</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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<h1>alloc.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/* -*- linux-c -*- */</span>
-00002
-00003 <span class="keyword">enum</span> errorcode { ERR_NONE=0, ERR_NO_MEM };
-00004 <span class="keyword">enum</span> errorcode _stp_error = ERR_NONE;
-00005 <span class="comment"></span>
-00006 <span class="comment">/** Allocates memory within a probe.</span>
-00007 <span class="comment"> * This is used for small allocations from within a running</span>
-00008 <span class="comment"> * probe where the process cannot sleep. </span>
-00009 <span class="comment"> * @param len Number of bytes to allocate.</span>
-00010 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span>
-00011 <span class="comment"> * @bug Currently uses kmalloc (GFP_ATOMIC).</span>
-00012 <span class="comment"> */</span>
-00013
-00014 <span class="keywordtype">void</span> *_stp_alloc(size_t len)
-00015 {
-00016 <span class="keywordtype">void</span> *ptr = kmalloc(len, GFP_ATOMIC);
-00017 <span class="keywordflow">if</span> (unlikely(ptr == NULL))
-00018 _stp_error = ERR_NO_MEM;
-00019 return ptr;
-00020 }
-00021 <span class="comment"></span>
-00022 <span class="comment">/** Allocates and clears memory within a probe.</span>
-00023 <span class="comment"> * This is used for small allocations from within a running</span>
-00024 <span class="comment"> * probe where the process cannot sleep. </span>
-00025 <span class="comment"> * @param len Number of bytes to allocate.</span>
-00026 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span>
-00027 <span class="comment"> * @bug Currently uses kmalloc (GFP_ATOMIC).</span>
-00028 <span class="comment"> */</span>
-00029
-00030 <span class="keywordtype">void</span> *_stp_calloc(size_t len)
-00031 {
-00032 <span class="keywordtype">void</span> *ptr = _stp_alloc(len);
-00033 <span class="keywordflow">if</span> (likely(ptr))
-00034 memset(ptr, 0, len);
-00035 return ptr;
-00036 }
-00037 <span class="comment"></span>
-00038 <span class="comment">/** Allocates and clears memory outside a probe.</span>
-00039 <span class="comment"> * This is typically used in the module initialization to</span>
-00040 <span class="comment"> * allocate new maps, lists, etc.</span>
-00041 <span class="comment"> * @param len Number of bytes to allocate.</span>
-00042 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span>
-00043 <span class="comment"> */</span>
-00044
-00045 <span class="keywordtype">void</span> *_stp_valloc(size_t len)
-00046 {
-00047 <span class="keywordtype">void</span> *ptr = vmalloc(len);
-00048 <span class="keywordflow">if</span> (likely(ptr))
-00049 memset(ptr, 0, len);
-00050 else
-00051 _stp_error = ERR_NO_MEM;
-00052 return ptr;
-00053 }
-00054 <span class="comment"></span>
-00055 <span class="comment">/** Frees memory allocated by _stp_alloc or _stp_calloc.</span>
-00056 <span class="comment"> * @param ptr pointer to memory to free</span>
-00057 <span class="comment"> */</span>
-00058
-00059 <span class="keywordtype">void</span> _stp_free(<span class="keywordtype">void</span> *ptr)
-00060 {
-00061 <span class="keywordflow">if</span> (likely(ptr))
-00062 kfree(ptr);
-00063 }
-00064 <span class="comment"></span>
-00065 <span class="comment">/** Frees memory allocated by _stp_valloc.</span>
-00066 <span class="comment"> * @param ptr pointer to memory to free</span>
-00067 <span class="comment"> */</span>
-00068
-00069 <span class="keywordtype">void</span> _stp_vfree(<span class="keywordtype">void</span> *ptr)
-00070 {
-00071 <span class="keywordflow">if</span> (likely(ptr))
-00072 vfree(ptr);
-00073 }
+<h1>alloc.h</h1><a href="alloc_8h.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 alloc.h</span>
+00003 <span class="comment"> * @brief Memory allocation functions.</span>
+00004 <span class="comment"> * @todo Should really be alloc.c for consistency.</span>
+00005 <span class="comment"> */</span>
+00006
+00007 <span class="keyword">enum</span> errorcode { ERR_NONE=0, ERR_NO_MEM };
+00008 <span class="keyword">enum</span> errorcode _stp_error = ERR_NONE;
+00009 <span class="comment"></span>
+00010 <span class="comment">/** Allocates memory within a probe.</span>
+00011 <span class="comment"> * This is used for small allocations from within a running</span>
+00012 <span class="comment"> * probe where the process cannot sleep. </span>
+00013 <span class="comment"> * @param len Number of bytes to allocate.</span>
+00014 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span>
+00015 <span class="comment"> * @bug Currently uses kmalloc (GFP_ATOMIC).</span>
+00016 <span class="comment"> */</span>
+00017
+<a name="l00018"></a><a class="code" href="alloc_8h.html#a3">00018</a> <span class="keywordtype">void</span> *<a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(size_t len)
+00019 {
+00020 <span class="keywordtype">void</span> *ptr = kmalloc(len, GFP_ATOMIC);
+00021 <span class="keywordflow">if</span> (unlikely(ptr == NULL))
+00022 _stp_error = ERR_NO_MEM;
+00023 <span class="keywordflow">return</span> ptr;
+00024 }
+00025 <span class="comment"></span>
+00026 <span class="comment">/** Allocates and clears memory within a probe.</span>
+00027 <span class="comment"> * This is used for small allocations from within a running</span>
+00028 <span class="comment"> * probe where the process cannot sleep. </span>
+00029 <span class="comment"> * @param len Number of bytes to allocate.</span>
+00030 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span>
+00031 <span class="comment"> * @bug Currently uses kmalloc (GFP_ATOMIC).</span>
+00032 <span class="comment"> */</span>
+00033
+<a name="l00034"></a><a class="code" href="alloc_8h.html#a4">00034</a> <span class="keywordtype">void</span> *<a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(size_t len)
+00035 {
+00036 <span class="keywordtype">void</span> *ptr = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(len);
+00037 <span class="keywordflow">if</span> (likely(ptr))
+00038 memset(ptr, 0, len);
+00039 <span class="keywordflow">return</span> ptr;
+00040 }
+00041 <span class="comment"></span>
+00042 <span class="comment">/** Allocates and clears memory outside a probe.</span>
+00043 <span class="comment"> * This is typically used in the module initialization to</span>
+00044 <span class="comment"> * allocate new maps, lists, etc.</span>
+00045 <span class="comment"> * @param len Number of bytes to allocate.</span>
+00046 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span>
+00047 <span class="comment"> */</span>
+00048
+<a name="l00049"></a><a class="code" href="alloc_8h.html#a5">00049</a> <span class="keywordtype">void</span> *<a class="code" href="alloc_8h.html#a5">_stp_valloc</a>(size_t len)
+00050 {
+00051 <span class="keywordtype">void</span> *ptr = vmalloc(len);
+00052 <span class="keywordflow">if</span> (likely(ptr))
+00053 memset(ptr, 0, len);
+00054 <span class="keywordflow">else</span>
+00055 _stp_error = ERR_NO_MEM;
+00056 <span class="keywordflow">return</span> ptr;
+00057 }
+00058 <span class="comment"></span>
+00059 <span class="comment">/** Frees memory allocated by _stp_alloc or _stp_calloc.</span>
+00060 <span class="comment"> * @param ptr pointer to memory to free</span>
+00061 <span class="comment"> */</span>
+00062
+<a name="l00063"></a><a class="code" href="alloc_8h.html#a6">00063</a> <span class="keywordtype">void</span> <a class="code" href="alloc_8h.html#a6">_stp_free</a>(<span class="keywordtype">void</span> *ptr)
+00064 {
+00065 <span class="keywordflow">if</span> (likely(ptr))
+00066 kfree(ptr);
+00067 }
+00068 <span class="comment"></span>
+00069 <span class="comment">/** Frees memory allocated by _stp_valloc.</span>
+00070 <span class="comment"> * @param ptr pointer to memory to free</span>
+00071 <span class="comment"> */</span>
+00072
+<a name="l00073"></a><a class="code" href="alloc_8h.html#a7">00073</a> <span class="keywordtype">void</span> <a class="code" href="alloc_8h.html#a7">_stp_vfree</a>(<span class="keywordtype">void</span> *ptr)
+00074 {
+00075 <span class="keywordflow">if</span> (likely(ptr))
+00076 vfree(ptr);
+00077 }
</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>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: alloc.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<h1>alloc.h File Reference</h1>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<h1>alloc.h File Reference</h1>Memory allocation functions. <a href="#_details">More...</a>
+<p>
+
<p>
<a href="alloc_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="alloc_8h.html#a8">errorcode</a> { <a class="el" href="alloc_8h.html#a8a1">ERR_NONE</a> = 0,
-<a class="el" href="alloc_8h.html#a8a2">ERR_NO_MEM</a>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b>errorcode</b> { <b>ERR_NONE</b> = 0,
+<b>ERR_NO_MEM</b>
}</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Frees memory allocated by _stp_valloc. <a href="#a7"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">enum <a class="el" href="alloc_8h.html#a8">errorcode</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="alloc_8h.html#a0">_stp_error</a> = ERR_NONE</td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0" doxytag="alloc.h::_stp_error"></a>
+enum errorcode </td><td class="memItemRight" valign="bottom"><b>_stp_error</b> = ERR_NONE</td></tr>
</table>
-<hr><h2>Enumeration Type Documentation</h2>
-<a class="anchor" name="a8" doxytag="alloc.h::errorcode"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">enum <a class="el" href="alloc_8h.html#a8">errorcode</a> </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
-
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Memory allocation functions.
<p>
-<dl compact><dt><b>Enumeration values: </b></dt><dd>
-<table border="0" cellspacing="2" cellpadding="0">
-<tr><td valign="top"><em><a class="anchor" name="a8a1" doxytag="ERR_NONE"></a>ERR_NONE</em> </td><td>
-</td></tr>
-<tr><td valign="top"><em><a class="anchor" name="a8a2" doxytag="ERR_NO_MEM"></a>ERR_NO_MEM</em> </td><td>
-</td></tr>
-</table>
-</dl>
+<dl compact><dt><b><a class="el" href="todo.html#_todo000001">Todo:</a></b></dt><dd>Should really be alloc.c for consistency. </dd></dl>
<p>
-Definition at line <a class="el" href="alloc_8h-source.html#l00001">1</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>. </td>
- </tr>
-</table>
-<hr><h2>Function Documentation</h2>
+Definition in file <a class="el" href="alloc_8h-source.html">alloc.h</a>.<hr><h2>Function Documentation</h2>
<a class="anchor" name="a3" doxytag="alloc.h::_stp_alloc"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="md" nowrap valign="top">size_t </td>
<td class="mdname1" valign="top" nowrap> <em>len</em> </td>
<td class="md" valign="top"> ) </td>
- <td class="md" nowrap><code> [inline]</code></td>
+ <td class="md" nowrap></td>
</tr>
</table>
</td>
<dl compact><dt><b><a class="el" href="bug.html#_bug000001">Bug:</a></b></dt><dd>Currently uses kmalloc (GFP_ATOMIC). </dd></dl>
<p>
-Definition at line <a class="el" href="alloc_8h-source.html#l00012">12</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
-<p>
-References <a class="el" href="alloc_8h-source.html#l00002">_stp_error</a>, and <a class="el" href="alloc_8h.html#a8a2">ERR_NO_MEM</a>.
+Definition at line <a class="el" href="alloc_8h-source.html#l00018">18</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
<p>
-Referenced by <a class="el" href="alloc_8h-source.html#l00028">_stp_calloc()</a>, and <a class="el" href="map_8c-source.html#l00571">_stp_map_set_str()</a>. </td>
+Referenced by <a class="el" href="alloc_8h-source.html#l00034">_stp_calloc()</a>, and <a class="el" href="map_8c-source.html#l00577">_stp_map_set_str()</a>. </td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="alloc.h::_stp_calloc"></a><p>
<td class="md" nowrap valign="top">size_t </td>
<td class="mdname1" valign="top" nowrap> <em>len</em> </td>
<td class="md" valign="top"> ) </td>
- <td class="md" nowrap><code> [inline]</code></td>
+ <td class="md" nowrap></td>
</tr>
</table>
</td>
<dl compact><dt><b><a class="el" href="bug.html#_bug000002">Bug:</a></b></dt><dd>Currently uses kmalloc (GFP_ATOMIC). </dd></dl>
<p>
-Definition at line <a class="el" href="alloc_8h-source.html#l00028">28</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
+Definition at line <a class="el" href="alloc_8h-source.html#l00034">34</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
<p>
-References <a class="el" href="alloc_8h-source.html#l00012">_stp_alloc()</a>.
+References <a class="el" href="alloc_8h-source.html#l00018">_stp_alloc()</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00656">_stp_map_set_stat()</a>, and <a class="el" href="map_8c-source.html#l00571">_stp_map_set_str()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00662">_stp_map_set_stat()</a>, and <a class="el" href="map_8c-source.html#l00577">_stp_map_set_str()</a>. </td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="alloc.h::_stp_free"></a><p>
<td class="md" nowrap valign="top">void * </td>
<td class="mdname1" valign="top" nowrap> <em>ptr</em> </td>
<td class="md" valign="top"> ) </td>
- <td class="md" nowrap><code> [inline]</code></td>
+ <td class="md" nowrap></td>
</tr>
</table>
</td>
</dl>
<p>
-Definition at line <a class="el" href="alloc_8h-source.html#l00057">57</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
+Definition at line <a class="el" href="alloc_8h-source.html#l00063">63</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00788">_stp_list_clear()</a>, <a class="el" href="map_8c-source.html#l00104">_stp_map_key_del()</a>, and <a class="el" href="map_8c-source.html#l00571">_stp_map_set_str()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00794">_stp_list_clear()</a>, <a class="el" href="map_8c-source.html#l00107">_stp_map_key_del()</a>, and <a class="el" href="map_8c-source.html#l00577">_stp_map_set_str()</a>. </td>
</tr>
</table>
<a class="anchor" name="a5" doxytag="alloc.h::_stp_valloc"></a><p>
<td class="md" nowrap valign="top">size_t </td>
<td class="mdname1" valign="top" nowrap> <em>len</em> </td>
<td class="md" valign="top"> ) </td>
- <td class="md" nowrap><code> [inline]</code></td>
+ <td class="md" nowrap></td>
</tr>
</table>
</td>
<dl compact><dt><b>Returns:</b></dt><dd>a valid pointer on success or NULL on failure. </dd></dl>
<p>
-Definition at line <a class="el" href="alloc_8h-source.html#l00043">43</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
+Definition at line <a class="el" href="alloc_8h-source.html#l00049">49</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
<p>
-References <a class="el" href="alloc_8h-source.html#l00002">_stp_error</a>, and <a class="el" href="alloc_8h.html#a8a2">ERR_NO_MEM</a>.
-<p>
-Referenced by <a class="el" href="map_8c-source.html#l00043">_stp_map_new()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00046">_stp_map_new()</a>. </td>
</tr>
</table>
<a class="anchor" name="a7" doxytag="alloc.h::_stp_vfree"></a><p>
<td class="md" nowrap valign="top">void * </td>
<td class="mdname1" valign="top" nowrap> <em>ptr</em> </td>
<td class="md" valign="top"> ) </td>
- <td class="md" nowrap><code> [inline]</code></td>
+ <td class="md" nowrap></td>
</tr>
</table>
</td>
</dl>
<p>
-Definition at line <a class="el" href="alloc_8h-source.html#l00067">67</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
-<p>
-Referenced by <a class="el" href="map_8c-source.html#l00190">_stp_map_del()</a>. </td>
- </tr>
-</table>
-<hr><h2>Variable Documentation</h2>
-<a class="anchor" name="a0" doxytag="alloc.h::_stp_error"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">enum <a class="el" href="alloc_8h.html#a8">errorcode</a> <a class="el" href="alloc_8h.html#a0">_stp_error</a> = ERR_NONE </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
-
-<p>
-
-<p>
-Definition at line <a class="el" href="alloc_8h-source.html#l00002">2</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
+Definition at line <a class="el" href="alloc_8h-source.html#l00073">73</a> of file <a class="el" href="alloc_8h-source.html">alloc.h</a>.
<p>
-Referenced by <a class="el" href="alloc_8h-source.html#l00012">_stp_alloc()</a>, and <a class="el" href="alloc_8h-source.html#l00043">_stp_valloc()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00194">_stp_map_del()</a>. </td>
</tr>
</table>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<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 Page</a> | <a class="qindexHL" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>SystemTap Data Structures</h1>Here are the data structures with brief descriptions:<table>
<tr><td class="indexkey"><a class="el" href="unionkey__data.html">key_data</a></td><td class="indexvalue">Keys are either longs or char * </td></tr>
- <tr><td class="indexkey"><a class="el" href="structmap__node.html">map_node</a></td><td class="indexvalue">All map nodes have the following structure </td></tr>
+ <tr><td class="indexkey"><a class="el" href="structmap__node.html">map_node</a></td><td class="indexvalue">Basic map element </td></tr>
+ <tr><td class="indexkey"><a class="el" href="structmap__node__int64.html">map_node_int64</a></td><td class="indexvalue">Map element containing int64 </td></tr>
+ <tr><td class="indexkey"><a class="el" href="structmap__node__stat.html">map_node_stat</a></td><td class="indexvalue">Map element containing stats </td></tr>
+ <tr><td class="indexkey"><a class="el" href="structmap__node__str.html">map_node_str</a></td><td class="indexvalue">Map element containing string </td></tr>
<tr><td class="indexkey"><a class="el" href="structmap__root.html">map_root</a></td><td class="indexvalue">This structure contains all information about a map </td></tr>
<tr><td class="indexkey"><a class="el" href="structstat.html">stat</a></td><td class="indexvalue">Statistics are stored in this struct </td></tr>
</table>
<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>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: Bug List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1><a class="anchor" name="bug">Bug List</a></h1><a class="anchor" name="_bug000001"></a> <dl>
<dt>Global <a class="el" href="alloc_8h.html#a3">_stp_alloc</a> (size_t len) </dt>
<dd>Currently uses kmalloc (GFP_ATOMIC). </dd>
<dt>Global <a class="el" href="io_8c.html#a4">dlog</a> (const char *fmt,...) </dt>
<dd>Lines are limited in length by printk buffer.</dd>
</dl>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related 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), "=&a" (__d0), "=&S" (__d1), \</span>
-00028 <span class="preprocessor"> "=&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), "=&a" (__d0), "=&S" (__d1), \</span>
-00056 <span class="preprocessor"> "=&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 <i>count</i> 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 <i>count</i> is smaller than the length of the string, copies </span>
-00074 <span class="comment"> * <i>count</i> bytes and returns <i>count</i>.</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 <i>list</i></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), "=&a" (__d0), "=&S" (__d1), \</span>
+00033 <span class="preprocessor"> "=&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), "=&a" (__d0), "=&S" (__d1), \</span>
+00061 <span class="preprocessor"> "=&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 <i>count</i> 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 <i>count</i> is smaller than the length of the string, copies </span>
+00079 <span class="comment"> * <i>count</i> bytes and returns <i>count</i>.</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->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 <i>list</i></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-><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>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: copy.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<h1>copy.c File Reference</h1>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<h1>copy.c File Reference</h1>Functions to copy from user space. <a href="#_details">More...</a>
+<p>
+
<p>
<a href="copy_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Copy an argv from user space to a List. <a href="#a2"></a><br></td></tr>
</table>
-<hr><h2>Function Documentation</h2>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Functions to copy from user space.
+<p>
+
+<p>
+Definition in file <a class="el" href="copy_8c-source.html">copy.c</a>.<hr><h2>Function Documentation</h2>
<a class="anchor" name="a2" doxytag="copy.c::_stp_copy_argv_from_user"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
}
</pre></div>
<p>
-Definition at line <a class="el" href="copy_8c-source.html#l00115">115</a> of file <a class="el" href="copy_8c-source.html">copy.c</a>.
+Definition at line <a class="el" href="copy_8c-source.html#l00119">119</a> of file <a class="el" href="copy_8c-source.html">copy.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00828">_stp_list_add_str()</a>, <a class="el" href="copy_8c-source.html#l00079">_stp_strncpy_from_user()</a>, and <a class="el" href="map_8h-source.html#l00053">map_root::num</a>. </td>
+References <a class="el" href="map_8c-source.html#l00834">_stp_list_add_str()</a>, <a class="el" href="copy_8c-source.html#l00083">_stp_strncpy_from_user()</a>, and <a class="el" href="map_8h-source.html#l00069">map_root::num</a>. </td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="copy.c::_stp_copy_from_user"></a><p>
<dl compact><dt><b>Returns:</b></dt><dd>number of bytes that could not be copied. On success, this will be zero. </dd></dl>
<p>
-Definition at line <a class="el" href="copy_8c-source.html#l00100">100</a> of file <a class="el" href="copy_8c-source.html">copy.c</a>. </td>
+Definition at line <a class="el" href="copy_8c-source.html#l00104">104</a> of file <a class="el" href="copy_8c-source.html">copy.c</a>. </td>
</tr>
</table>
<a class="anchor" name="a0" doxytag="copy.c::_stp_strncpy_from_user"></a><p>
</dl>
If <em>count</em> is smaller than the length of the string, copies <em>count</em> bytes and returns <em>count</em>.
<p>
-Definition at line <a class="el" href="copy_8c-source.html#l00079">79</a> of file <a class="el" href="copy_8c-source.html">copy.c</a>.
+Definition at line <a class="el" href="copy_8c-source.html#l00083">83</a> of file <a class="el" href="copy_8c-source.html">copy.c</a>.
<p>
-Referenced by <a class="el" href="copy_8c-source.html#l00115">_stp_copy_argv_from_user()</a>. </td>
+Referenced by <a class="el" href="copy_8c-source.html#l00119">_stp_copy_argv_from_user()</a>. </td>
</tr>
</table>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
This directory contains working example probes that demonstrate and test the runtime library.
<p>
They are tested on i386 and x86_64. <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>
<tr><td colspan="2"><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>dtr.c</b> <a href="shellsnoop_2dtr_8c-source.html">[code]</a></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>dtr.mod.c</b> <a href="dtr_8mod_8c-source.html">[code]</a></td></tr>
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>README</b> <a href="probes_2shellsnoop_2README-source.html">[code]</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Snoops on what commands are being run by shells.
<p>
-This is a translation of on an old dtr probe. It demonstrates maps, lists, and how to use _stp_copy_argv_from_user() and _stp_strncpy_from_user().<p>
+This is a translation of on an old dtr probe. It demonstrates maps, lists, and how to use <a class="el" href="copy_8c.html#a2">_stp_copy_argv_from_user()</a> and <a class="el" href="copy_8c.html#a0">_stp_strncpy_from_user()</a>.<p>
Original dtr source:<p>
<div class="fragment"><pre class="fragment">
# shellsnoop.probe - snoop shell execution as it occurs.
}
}
</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>
> insmod stp_tasklet.ko
> rmmod stp_tasklet.ko
</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>
@writes[current->comm] << count;
}
</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>
This is a silly little instrumentation routine to instrument functions entry by name.
<p>
It makes use of the SystemTap runtime libraries to break down the number of times the function by caller.<p>
-It demonstrates kprobes, passing a module parameter, using the print buffer, and using _stp_print_symbol() to map the addresses back to locations in functions.<p>
+It demonstrates kprobes, passing a module parameter, using the print buffer, and using <a class="el" href="io_8c.html#a7">_stp_print_symbol()</a> to map the addresses back to locations in functions.<p>
By default it instruments schedule().<p>
The instrumentation module is built by having the kernel that is going to be instrumented currently on the machine and doing <div class="fragment"><pre class="fragment">./build
</pre></div> The instrumentation is inserted as root with: <div class="fragment"><pre class="fragment">/sbin/insmod kprobe_funct_where.ko funct_name=function_name
</pre></div> The instrumentation is removed as root with: <div class="fragment"><pre class="fragment">/sbin/rmmod kprobe_funct_where
</pre></div> -Will Cohen <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>
</ul>
</ul>
<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>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindexHL" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>SystemTap File List</h1>Here is a list of all documented files with brief descriptions:<table>
- <tr><td class="indexkey"><b>alloc.h</b> <a href="alloc_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
- <tr><td class="indexkey"><b>copy.c</b> <a href="copy_8c-source.html">[code]</a></td><td class="indexvalue"></td></tr>
- <tr><td class="indexkey"><b>io.c</b> <a href="io_8c-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="alloc_8h.html">alloc.h</a> <a href="alloc_8h-source.html">[code]</a></td><td class="indexvalue">Memory allocation functions </td></tr>
+ <tr><td class="indexkey"><a class="el" href="copy_8c.html">copy.c</a> <a href="copy_8c-source.html">[code]</a></td><td class="indexvalue">Functions to copy from user space </td></tr>
+ <tr><td class="indexkey"><a class="el" href="io_8c.html">io.c</a> <a href="io_8c-source.html">[code]</a></td><td class="indexvalue">I/O functions </td></tr>
<tr><td class="indexkey"><a class="el" href="map_8c.html">map.c</a> <a href="map_8c-source.html">[code]</a></td><td class="indexvalue">Implements maps (associative arrays) and lists </td></tr>
<tr><td class="indexkey"><a class="el" href="map_8h.html">map.h</a> <a href="map_8h-source.html">[code]</a></td><td class="indexvalue">Header file for maps and lists </td></tr>
- <tr><td class="indexkey"><b>probes.c</b> <a href="probes_8c-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="probes_8c.html">probes.c</a> <a href="probes_8c-source.html">[code]</a></td><td class="indexvalue">Functions to assist loading and unloading groups of probes </td></tr>
<tr><td class="indexkey"><b>README</b> <a href="README-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>runtime.h</b> <a href="runtime_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>stack.c</b> <a href="stack_8c-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">probes/<b>README</b> <a href="probes_2README-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">probes/shellsnoop/<b>dtr.c</b> <a href="shellsnoop_2dtr_8c-source.html">[code]</a></td><td class="indexvalue"></td></tr>
- <tr><td class="indexkey">probes/shellsnoop/<b>dtr.mod.c</b> <a href="dtr_8mod_8c-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">probes/shellsnoop/<b>README</b> <a href="probes_2shellsnoop_2README-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">probes/tasklet/<b>README</b> <a href="probes_2tasklet_2README-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">probes/tasklet/<b>stp_tasklet.c</b> <a href="stp__tasklet_8c-source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">probes/where_func/<b>README</b> <a href="probes_2where__func_2README-source.html">[code]</a></td><td class="indexvalue"></td></tr>
</table>
<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>
<p>
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:<ul>
-<li>maxnum
-: <a class="el" href="structmap__root.html#o1">map_root</a><li>num
-: <a class="el" href="structmap__root.html#o2">map_root</a></ul>
+<li>create
+: <a class="el" href="structmap__root.html#o7">map_root</a><li>hashes
+: <a class="el" href="structmap__root.html#o13">map_root</a><li>head
+: <a class="el" href="structmap__root.html#o4">map_root</a><li>hnode
+: <a class="el" href="structmap__node.html#o1">map_node</a><li>key
+: <a class="el" href="structmap__root.html#o6">map_root</a><li>lnode
+: <a class="el" href="structmap__node.html#o0">map_node</a><li>maxnum
+: <a class="el" href="structmap__root.html#o1">map_root</a><li>membuf
+: <a class="el" href="structmap__root.html#o14">map_root</a><li>no_wrap
+: <a class="el" href="structmap__root.html#o3">map_root</a><li>num
+: <a class="el" href="structmap__root.html#o2">map_root</a><li>pool
+: <a class="el" href="structmap__root.html#o5">map_root</a><li>type
+: <a class="el" href="structmap__root.html#o0">map_root</a></ul>
<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>
<p>
<ul>
-<li>maxnum
-: <a class="el" href="structmap__root.html#o1">map_root</a><li>num
-: <a class="el" href="structmap__root.html#o2">map_root</a></ul>
+<li>create
+: <a class="el" href="structmap__root.html#o7">map_root</a><li>hashes
+: <a class="el" href="structmap__root.html#o13">map_root</a><li>head
+: <a class="el" href="structmap__root.html#o4">map_root</a><li>hnode
+: <a class="el" href="structmap__node.html#o1">map_node</a><li>key
+: <a class="el" href="structmap__root.html#o6">map_root</a><li>lnode
+: <a class="el" href="structmap__node.html#o0">map_node</a><li>maxnum
+: <a class="el" href="structmap__root.html#o1">map_root</a><li>membuf
+: <a class="el" href="structmap__root.html#o14">map_root</a><li>no_wrap
+: <a class="el" href="structmap__root.html#o3">map_root</a><li>num
+: <a class="el" href="structmap__root.html#o2">map_root</a><li>pool
+: <a class="el" href="structmap__root.html#o5">map_root</a><li>type
+: <a class="el" href="structmap__root.html#o0">map_root</a></ul>
<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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindexHL" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<div class="qindex"><a class="qindexHL" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindexHL" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="#index__">_</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_f">f</a> | <a class="qindex" href="#index_k">k</a> | <a class="qindex" href="#index_m">m</a> | <a class="qindex" href="#index_p">p</a> | <a class="qindex" href="#index_v">v</a></div>
<p>
-Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:<ul>
-<li>_stp_list_add_int64()
+
+<p>
+Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:<h3><a class="anchor" name="index__">- _ -</a></h3><ul>
+<li>_stp_alloc()
+: <a class="el" href="alloc_8h.html#a3">alloc.h</a><li>_stp_calloc()
+: <a class="el" href="alloc_8h.html#a4">alloc.h</a><li>_stp_copy_argv_from_user()
+: <a class="el" href="copy_8c.html#a2">copy.c</a><li>_stp_copy_from_user()
+: <a class="el" href="copy_8c.html#a1">copy.c</a><li>_stp_free()
+: <a class="el" href="alloc_8h.html#a6">alloc.h</a><li>_stp_kallsyms_lookup
+: <a class="el" href="io_8c.html#a1">io.c</a><li>_stp_list_add
+: <a class="el" href="map_8h.html#a7">map.h</a><li>_stp_list_add_int64()
: <a class="el" href="map_8c.html#a28">map.c</a><li>_stp_list_add_str()
: <a class="el" href="map_8c.html#a27">map.c</a><li>_stp_list_clear()
: <a class="el" href="map_8c.html#a26">map.c</a><li>_stp_list_new()
: <a class="el" href="map_8c.html#a25">map.c</a><li>_stp_list_size()
-: <a class="el" href="map_8c.html#a29">map.c</a><li>_stp_map_add_int64()
+: <a class="el" href="map_8c.html#a29">map.c</a><li>_stp_lookup_name
+: <a class="el" href="probes_8c.html#a0">probes.c</a><li>_stp_map_add_int64()
: <a class="el" href="map_8c.html#a18">map.c</a><li>_stp_map_del()
: <a class="el" href="map_8c.html#a8">map.c</a><li>_stp_map_get_int64()
: <a class="el" href="map_8c.html#a19">map.c</a><li>_stp_map_get_stat()
: <a class="el" href="map_8c.html#a23">map.c</a><li>_stp_map_get_str()
: <a class="el" href="map_8c.html#a21">map.c</a><li>_stp_map_iter()
-: <a class="el" href="map_8c.html#a7">map.c</a><li>_stp_map_key_del()
+: <a class="el" href="map_8c.html#a7">map.c</a><li>_stp_map_key
+: <a class="el" href="map_8h.html#a5">map.h</a><li>_stp_map_key2
+: <a class="el" href="map_8h.html#a4">map.h</a><li>_stp_map_key_del()
: <a class="el" href="map_8c.html#a5">map.c</a><li>_stp_map_key_long()
: <a class="el" href="map_8c.html#a14">map.c</a><li>_stp_map_key_long_long()
: <a class="el" href="map_8c.html#a9">map.c</a><li>_stp_map_key_long_str()
: <a class="el" href="map_8c.html#a13">map.c</a><li>_stp_map_key_str_long()
: <a class="el" href="map_8c.html#a11">map.c</a><li>_stp_map_key_str_str()
: <a class="el" href="map_8c.html#a10">map.c</a><li>_stp_map_new()
-: <a class="el" href="map_8c.html#a3">map.c</a><li>_stp_map_set_int64()
+: <a class="el" href="map_8c.html#a3">map.c</a><li>_stp_map_set
+: <a class="el" href="map_8h.html#a6">map.h</a><li>_stp_map_set_int64()
: <a class="el" href="map_8c.html#a17">map.c</a><li>_stp_map_set_stat()
: <a class="el" href="map_8c.html#a22">map.c</a><li>_stp_map_set_str()
: <a class="el" href="map_8c.html#a20">map.c</a><li>_stp_map_start()
: <a class="el" href="map_8c.html#a6">map.c</a><li>_stp_map_stat_add()
-: <a class="el" href="map_8c.html#a24">map.c</a><li>foreach
-: <a class="el" href="map_8h.html#a8">map.h</a><li>MAP
+: <a class="el" href="map_8c.html#a24">map.c</a><li>_stp_pbuf
+: <a class="el" href="io_8c.html#a2">io.c</a><li>_stp_print_buf()
+: <a class="el" href="io_8c.html#a5">io.c</a><li>_stp_print_buf_init()
+: <a class="el" href="io_8c.html#a6">io.c</a><li>_stp_print_symbol()
+: <a class="el" href="io_8c.html#a7">io.c</a><li>_stp_register_jprobes()
+: <a class="el" href="probes_8c.html#a2">probes.c</a><li>_stp_register_kprobes()
+: <a class="el" href="probes_8c.html#a4">probes.c</a><li>_stp_strncpy_from_user()
+: <a class="el" href="copy_8c.html#a0">copy.c</a><li>_stp_unregister_jprobes()
+: <a class="el" href="probes_8c.html#a1">probes.c</a><li>_stp_unregister_kprobes()
+: <a class="el" href="probes_8c.html#a3">probes.c</a><li>_stp_valloc()
+: <a class="el" href="alloc_8h.html#a5">alloc.h</a><li>_stp_vfree()
+: <a class="el" href="alloc_8h.html#a7">alloc.h</a></ul>
+<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
+<li>cur_ret_addr()
+: <a class="el" href="io_8c.html#a8">io.c</a></ul>
+<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
+<li>dlog()
+: <a class="el" href="io_8c.html#a4">io.c</a></ul>
+<h3><a class="anchor" name="index_f">- f -</a></h3><ul>
+<li>foreach
+: <a class="el" href="map_8h.html#a8">map.h</a></ul>
+<h3><a class="anchor" name="index_k">- k -</a></h3><ul>
+<li>key1int
+: <a class="el" href="map_8h.html#a2">map.h</a><li>key1str
+: <a class="el" href="map_8h.html#a0">map.h</a><li>key2int
+: <a class="el" href="map_8h.html#a3">map.h</a><li>key2str
+: <a class="el" href="map_8h.html#a1">map.h</a><li>keytype
+: <a class="el" href="map_8h.html#a18">map.h</a></ul>
+<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
+<li>MAP
: <a class="el" href="map_8h.html#a10">map.h</a></ul>
+<h3><a class="anchor" name="index_p">- p -</a></h3><ul>
+<li>packed
+: <a class="el" href="map_8h.html#a9">map.h</a></ul>
+<h3><a class="anchor" name="index_v">- v -</a></h3><ul>
+<li>valtype
+: <a class="el" href="map_8h.html#a19">map.h</a></ul>
<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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindexHL" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindexHL" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindexHL" href="globals_defs.html">Defines</a></div>
<p>
<ul>
-<li>foreach
-: <a class="el" href="map_8h.html#a8">map.h</a></ul>
+<li>_stp_list_add
+: <a class="el" href="map_8h.html#a7">map.h</a><li>_stp_map_key
+: <a class="el" href="map_8h.html#a5">map.h</a><li>_stp_map_key2
+: <a class="el" href="map_8h.html#a4">map.h</a><li>_stp_map_set
+: <a class="el" href="map_8h.html#a6">map.h</a><li>foreach
+: <a class="el" href="map_8h.html#a8">map.h</a><li>key1int
+: <a class="el" href="map_8h.html#a2">map.h</a><li>key1str
+: <a class="el" href="map_8h.html#a0">map.h</a><li>key2int
+: <a class="el" href="map_8h.html#a3">map.h</a><li>key2str
+: <a class="el" href="map_8h.html#a1">map.h</a></ul>
<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>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: Globals - Enumerations</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindexHL" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindexHL" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindexHL" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
<p>
<ul>
-<li>errorcode
-: <a class="el" href="alloc_8h.html#a8">alloc.h</a><li>keytype
+<li>keytype
: <a class="el" href="map_8h.html#a18">map.h</a><li>valtype
: <a class="el" href="map_8h.html#a19">map.h</a></ul>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindexHL" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindexHL" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindexHL" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="#index__">_</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a></div>
<p>
-<ul>
-<li>_stp_list_add_int64()
+
+<p>
+<h3><a class="anchor" name="index__">- _ -</a></h3><ul>
+<li>_stp_alloc()
+: <a class="el" href="alloc_8h.html#a3">alloc.h</a><li>_stp_calloc()
+: <a class="el" href="alloc_8h.html#a4">alloc.h</a><li>_stp_copy_argv_from_user()
+: <a class="el" href="copy_8c.html#a2">copy.c</a><li>_stp_copy_from_user()
+: <a class="el" href="copy_8c.html#a1">copy.c</a><li>_stp_free()
+: <a class="el" href="alloc_8h.html#a6">alloc.h</a><li>_stp_list_add_int64()
: <a class="el" href="map_8c.html#a28">map.c</a><li>_stp_list_add_str()
: <a class="el" href="map_8c.html#a27">map.c</a><li>_stp_list_clear()
: <a class="el" href="map_8c.html#a26">map.c</a><li>_stp_list_new()
: <a class="el" href="map_8c.html#a22">map.c</a><li>_stp_map_set_str()
: <a class="el" href="map_8c.html#a20">map.c</a><li>_stp_map_start()
: <a class="el" href="map_8c.html#a6">map.c</a><li>_stp_map_stat_add()
-: <a class="el" href="map_8c.html#a24">map.c</a></ul>
+: <a class="el" href="map_8c.html#a24">map.c</a><li>_stp_print_buf()
+: <a class="el" href="io_8c.html#a5">io.c</a><li>_stp_print_buf_init()
+: <a class="el" href="io_8c.html#a6">io.c</a><li>_stp_print_symbol()
+: <a class="el" href="io_8c.html#a7">io.c</a><li>_stp_register_jprobes()
+: <a class="el" href="probes_8c.html#a2">probes.c</a><li>_stp_register_kprobes()
+: <a class="el" href="probes_8c.html#a4">probes.c</a><li>_stp_strncpy_from_user()
+: <a class="el" href="copy_8c.html#a0">copy.c</a><li>_stp_unregister_jprobes()
+: <a class="el" href="probes_8c.html#a1">probes.c</a><li>_stp_unregister_kprobes()
+: <a class="el" href="probes_8c.html#a3">probes.c</a><li>_stp_valloc()
+: <a class="el" href="alloc_8h.html#a5">alloc.h</a><li>_stp_vfree()
+: <a class="el" href="alloc_8h.html#a7">alloc.h</a></ul>
+<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
+<li>cur_ret_addr()
+: <a class="el" href="io_8c.html#a8">io.c</a></ul>
+<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
+<li>dlog()
+: <a class="el" href="io_8c.html#a4">io.c</a></ul>
<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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindexHL" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindexHL" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindexHL" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
<p>
<ul>
<li>MAP
: <a class="el" href="map_8h.html#a10">map.h</a></ul>
<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>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: Globals - Variables</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindexHL" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindexHL" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindexHL" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
<p>
<ul>
-<li>_stp_error
-: <a class="el" href="alloc_8h.html#a0">alloc.h</a><li>packed
+<li>_stp_kallsyms_lookup
+: <a class="el" href="io_8c.html#a1">io.c</a><li>_stp_lookup_name
+: <a class="el" href="probes_8c.html#a0">probes.c</a><li>_stp_pbuf
+: <a class="el" href="io_8c.html#a2">io.c</a><li>packed
: <a class="el" href="map_8h.html#a9">map.h</a></ul>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
Working sample probe code using the runtime is in runtime/probes. <a href="dir_000000.html">Browse probes.</a><h2><a class="anchor" name="todo_sec">
ToDo</a></h2>
<a class="el" href="todo.html">Click Here for Complete List </a> <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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<h1>io.c</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/** Logs data.</span>
-00002 <span class="comment"> * This function is compatible with printk. In fact it currently</span>
-00003 <span class="comment"> * sends all output to vprintk, after sending "STP: ". This allows</span>
-00004 <span class="comment"> * us to easily detect SystemTap output in the log file.</span>
-00005 <span class="comment"> *</span>
-00006 <span class="comment"> * @param fmt A variable number of args.</span>
-00007 <span class="comment"> * @bug Lines are limited in length by printk buffer.</span>
-00008 <span class="comment"> * @todo Needs replaced with something much faster that does not</span>
-00009 <span class="comment"> * use the system log.</span>
-00010 <span class="comment"> */</span>
-00011 <span class="keywordtype">void</span> dlog (<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
-00012 {
-00013 va_list args;
-00014 printk(<span class="stringliteral">"STP: "</span>);
-00015 va_start(args, fmt);
-00016 vprintk(fmt, args);
-00017 va_end(args);
-00018 }
-00019
-00020
-00021 <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,
-00022 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *symbolsize,
-00023 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *offset,
-00024 <span class="keywordtype">char</span> **modname, <span class="keywordtype">char</span> *namebuf)=(<span class="keywordtype">void</span> *)KALLSYMS_LOOKUP;
-00025
-00026
-00027 <span class="preprocessor">#define STP_BUF_LEN 8191</span>
-00028 <span class="preprocessor"></span>
-00029 <span class="comment">/* FIXME. These need to be per-cpu */</span>
-00030 <span class="keyword">static</span> <span class="keywordtype">char</span> _stp_pbuf[STP_BUF_LEN+1];
-00031 <span class="keyword">static</span> <span class="keywordtype">int</span> _stp_pbuf_len = STP_BUF_LEN;
-00032
-00033 <span class="keywordtype">void</span> _stp_print_buf (<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
-00034 {
-00035 <span class="keywordtype">int</span> num;
-00036 va_list args;
-00037 <span class="keywordtype">char</span> *buf = _stp_pbuf + STP_BUF_LEN - _stp_pbuf_len;
-00038 va_start(args, fmt);
-00039 num = vscnprintf(buf, _stp_pbuf_len, fmt, args);
-00040 va_end(args);
-00041 <span class="keywordflow">if</span> (num > 0)
-00042 _stp_pbuf_len -= num;
-00043 }
-00044
-00045 <span class="keywordtype">void</span> _stp_print_buf_init (<span class="keywordtype">void</span>)
-00046 {
-00047 _stp_pbuf_len = STP_BUF_LEN;
-00048 _stp_pbuf[0] = 0;
-00049 }
-00050
-00051 <span class="keywordtype">void</span> _stp_print_symbol(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> address)
-00052 {
-00053 <span class="keywordtype">char</span> *modname;
-00054 <span class="keyword">const</span> <span class="keywordtype">char</span> *name;
-00055 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> offset, size;
-00056 <span class="keywordtype">char</span> namebuf[KSYM_NAME_LEN+1];
-00057
-00058 name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf);
-00059
-00060 <span class="keywordflow">if</span> (!name)
-00061 _stp_print_buf("0x%lx", address);
-00062 else {
-00063 <span class="keywordflow">if</span> (modname)
-00064 _stp_print_buf("%s+%#lx/%#lx [%s]", name, offset,
-00065 size, modname);
-00066 else
-00067 _stp_print_buf("%s+%#lx/%#lx", name, offset, size);
-00068 }
-00069 }
-00070
-00071
-00072 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> cur_ret_addr (struct pt_regs *regs)
+<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 > 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 <span class="preprocessor">#ifdef __x86_64__</span>
-00075 <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->rsp;
-00076 <span class="preprocessor">#else</span>
-00077 <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->esp;
-00078 <span class="preprocessor">#endif</span>
-00079 <span class="preprocessor"></span> <span class="keywordflow">if</span> (ra)
-00080 return *ra;
-00081 else
-00082 return 0;
-00083 }
+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, &size, &offset, &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->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->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 00:32:02 2005 for SystemTap.</small></body>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: io.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<h1>io.c File Reference</h1>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<h1>io.c File Reference</h1>I/O functions. <a href="#_details">More...</a>
+<p>
+
<p>
<a href="io_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a0">STP_BUF_LEN</a> 8191</td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0" doxytag="io.c::STP_BUF_LEN"></a>
+#define </td><td class="memItemRight" valign="bottom"><b>STP_BUF_LEN</b> 8191</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a4">dlog</a> (const char *fmt,...)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Logs data. <a href="#a4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a5">_stp_print_buf</a> (const char *fmt,...)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Print into the print buffer. <a href="#a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a6">_stp_print_buf_init</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Clear the print buffer. <a href="#a6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a7">_stp_print_symbol</a> (const char *fmt, unsigned long address)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Print addresses symbolically into the print buffer. <a href="#a7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a8">cur_ret_addr</a> (struct pt_regs *regs)</td></tr>
-</table>
-<hr><h2>Define Documentation</h2>
-<a class="anchor" name="a0" doxytag="io.c::STP_BUF_LEN"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">#define STP_BUF_LEN 8191 </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the current return address. <a href="#a8"></a><br></td></tr>
+<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">static const char *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a1">_stp_kallsyms_lookup</a> )(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char **modname, char *namebuf) = (void *)KALLSYMS_LOOKUP</td></tr>
-<p>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Lookup symbol. <a href="#a1"></a><br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2" doxytag="io.c::_stp_pbuf"></a>
+static char </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a2">_stp_pbuf</a> [8191+1]</td></tr>
+
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Static buffer for printing. <br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a3" doxytag="io.c::_stp_pbuf_len"></a>
+static int </td><td class="memItemRight" valign="bottom"><b>_stp_pbuf_len</b> = 8191</td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+I/O functions.
<p>
-Definition at line <a class="el" href="io_8c-source.html#l00027">27</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
+
<p>
-Referenced by <a class="el" href="io_8c-source.html#l00033">_stp_print_buf()</a>, and <a class="el" href="io_8c-source.html#l00045">_stp_print_buf_init()</a>. </td>
- </tr>
-</table>
-<hr><h2>Function Documentation</h2>
+Definition in file <a class="el" href="io_8c-source.html">io.c</a>.<hr><h2>Function Documentation</h2>
<a class="anchor" name="a5" doxytag="io.c::_stp_print_buf"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td>
<p>
+Print into the print buffer.
+<p>
+Like printf, except output goes into _stp_pbuf, which will contain the null-terminated output. Safe because overflowing _stp_pbuf is not allowed. Size is limited by length of print buffer.<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign="top"></td><td valign="top"><em>fmt</em> </td><td>A variable number of args. </td></tr>
+ </table>
+</dl>
+<dl compact><dt><b>Note:</b></dt><dd>Formatting output should never be done within a probe. Use at module exit time. </dd></dl>
+<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="io_8c.html#a6">_stp_print_buf_init</a> </dd></dl>
<p>
-Definition at line <a class="el" href="io_8c-source.html#l00033">33</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
+Definition at line <a class="el" href="io_8c-source.html#l00055">55</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
-References <a class="el" href="io_8c-source.html#l00027">STP_BUF_LEN</a>.
+References <a class="el" href="io_8c-source.html#l00040">_stp_pbuf</a>.
<p>
-Referenced by <a class="el" href="io_8c-source.html#l00051">_stp_print_symbol()</a>. </td>
+Referenced by <a class="el" href="io_8c-source.html#l00085">_stp_print_symbol()</a>. </td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="io.c::_stp_print_buf_init"></a><p>
<td>
<p>
-
+Clear the print buffer.
+<p>
+Output from <a class="el" href="io_8c.html#a5">_stp_print_buf()</a> will accumulate in the buffer until this is called.
<p>
-Definition at line <a class="el" href="io_8c-source.html#l00045">45</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
+Definition at line <a class="el" href="io_8c-source.html#l00072">72</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
-References <a class="el" href="io_8c-source.html#l00027">STP_BUF_LEN</a>. </td>
+References <a class="el" href="io_8c-source.html#l00040">_stp_pbuf</a>. </td>
</tr>
</table>
<a class="anchor" name="a7" doxytag="io.c::_stp_print_symbol"></a><p>
<td>
<p>
+Print addresses symbolically into the print buffer.
+<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign="top"></td><td valign="top"><em>fmt</em> </td><td>A variable number of args. </td></tr>
+ <tr><td valign="top"></td><td valign="top"><em>address</em> </td><td>The address to lookup. </td></tr>
+ </table>
+</dl>
+<dl compact><dt><b>Note:</b></dt><dd>Formatting output should never be done within a probe. Use at module exit time. </dd></dl>
<p>
-Definition at line <a class="el" href="io_8c-source.html#l00051">51</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
+Definition at line <a class="el" href="io_8c-source.html#l00085">85</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
-References <a class="el" href="io_8c-source.html#l00033">_stp_print_buf()</a>. </td>
+References <a class="el" href="io_8c-source.html#l00031">_stp_kallsyms_lookup</a>, and <a class="el" href="io_8c-source.html#l00055">_stp_print_buf()</a>. </td>
</tr>
</table>
<a class="anchor" name="a8" doxytag="io.c::cur_ret_addr"></a><p>
<td>
<p>
+Get the current return address.
+<p>
+Call from kprobes (not jprobes). <dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign="top"></td><td valign="top"><em>regs</em> </td><td>The pt_regs saved by the kprobe. </td></tr>
+ </table>
+</dl>
+<dl compact><dt><b>Returns:</b></dt><dd>The return address saved in esp or rsp. </dd></dl>
+<dl compact><dt><b>Note:</b></dt><dd>i386 and x86_64 only. </dd></dl>
<p>
-Definition at line <a class="el" href="io_8c-source.html#l00072">72</a> of file <a class="el" href="io_8c-source.html">io.c</a>. </td>
+Definition at line <a class="el" href="io_8c-source.html#l00112">112</a> of file <a class="el" href="io_8c-source.html">io.c</a>. </td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="io.c::dlog"></a><p>
</dl>
<dl compact><dt><b><a class="el" href="bug.html#_bug000003">Bug:</a></b></dt><dd>Lines are limited in length by printk buffer.</dd></dl>
<p>
-<dl compact><dt><b><a class="el" href="todo.html#_todo000001">Todo:</a></b></dt><dd>Needs replaced with something much faster that does not use the system log. </dd></dl>
+<dl compact><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>Needs replaced with something much faster that does not use the system log. </dd></dl>
<p>
-Definition at line <a class="el" href="io_8c-source.html#l00011">11</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
+Definition at line <a class="el" href="io_8c-source.html#l00016">16</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
+<p>
+Referenced by <a class="el" href="map_8c-source.html#l00794">_stp_list_clear()</a>, <a class="el" href="probes_8c-source.html#l00032">_stp_register_jprobes()</a>, <a class="el" href="probes_8c-source.html#l00077">_stp_register_kprobes()</a>, <a class="el" href="probes_8c-source.html#l00018">_stp_unregister_jprobes()</a>, and <a class="el" href="probes_8c-source.html#l00063">_stp_unregister_kprobes()</a>. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a1" doxytag="io.c::_stp_kallsyms_lookup"></a><p>
+<table class="mdTable" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top">const char*(* <a class="el" href="io_8c.html#a1">_stp_kallsyms_lookup</a>)(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char **modname, char *namebuf) = (void *)KALLSYMS_LOOKUP<code> [static]</code> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing="5" cellpadding="0" border="0">
+ <tr>
+ <td>
+
+ </td>
+ <td>
+
+<p>
+Lookup symbol.
+<p>
+This simply calls the kernel function kallsyms_lookup(). That function is not exported, so this workaround is required. See the kernel source, kernel/kallsyms.c for more information.
+<p>
+Definition at line <a class="el" href="io_8c-source.html#l00031">31</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00788">_stp_list_clear()</a>, <a class="el" href="probes_8c-source.html#l00022">_stp_register_jprobes()</a>, <a class="el" href="probes_8c-source.html#l00056">_stp_register_kprobes()</a>, <a class="el" href="probes_8c-source.html#l00014">_stp_unregister_jprobes()</a>, and <a class="el" href="probes_8c-source.html#l00048">_stp_unregister_kprobes()</a>. </td>
+Referenced by <a class="el" href="io_8c-source.html#l00085">_stp_print_symbol()</a>. </td>
</tr>
</table>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
00008 <span class="preprocessor"></span><span class="preprocessor">#define BUCKETS 16 </span><span class="comment">/* largest histogram width */</span>
00009
00010 <span class="preprocessor">#include "runtime.h"</span>
-00011 <span class="preprocessor">#include "io.c"</span>
+00011 <span class="preprocessor">#include "<a class="code" href="io_8c.html">io.c</a>"</span>
00012 <span class="preprocessor">#include "<a class="code" href="map_8c.html">map.c</a>"</span>
-00013 <span class="preprocessor">#include "probes.c"</span>
+00013 <span class="preprocessor">#include "<a class="code" href="probes_8c.html">probes.c</a>"</span>
00014
00015 MODULE_DESCRIPTION(<span class="stringliteral">"SystemTap probe: where_func"</span>);
00016 MODULE_AUTHOR(<span class="stringliteral">"Will Cohen and Martin Hunt"</span>);
00026
00027 <span class="keyword">static</span> <span class="keywordtype">int</span> inst_funct(<span class="keyword">struct</span> kprobe *p, <span class="keyword">struct</span> pt_regs *regs)
00028 {
-00029 <span class="keywordtype">long</span> ret_addr = cur_ret_addr(regs);
+00029 <span class="keywordtype">long</span> ret_addr = <a class="code" href="io_8c.html#a8">cur_ret_addr</a>(regs);
00030 ++count_funct;
00031 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(funct_locations, ret_addr);
00032 <a class="code" href="map_8c.html#a18">_stp_map_add_int64</a>(funct_locations, 1);
00058
00059 <span class="keywordtype">void</span> cleanup_module(<span class="keywordtype">void</span>)
00060 {
-00061 <span class="keyword">struct </span>map_node_int64 *ptr;
+00061 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *ptr;
00062
-00063 _stp_unregister_kprobes (kp, MAX_KPROBES);
+00063 <a class="code" href="probes_8c.html#a3">_stp_unregister_kprobes</a> (kp, MAX_KPROBES);
00064
-00065 dlog(<span class="stringliteral">"%s() called %d times.\n"</span>, funct_name, count_funct);
-00066 dlog(<span class="stringliteral">"NUM\tCaller Addr\tCaller Name\n"</span>, funct_name);
+00065 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"%s() called %d times.\n"</span>, funct_name, count_funct);
+00066 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"NUM\tCaller Addr\tCaller Name\n"</span>, funct_name);
00067
00068 <span class="comment">/* now walk the hash table and print out all the information */</span>
00069 <a class="code" href="map_8h.html#a8">foreach</a>(funct_locations, ptr) {
-00070 _stp_print_buf_init();
-00071 _stp_print_symbol(<span class="stringliteral">"%s\n"</span>, key1int(ptr));
-00072 dlog(<span class="stringliteral">"%lld\t0x%p\t(%s)\n"</span>, ptr->val, key1int(ptr), _stp_pbuf);
+00070 <a class="code" href="io_8c.html#a6">_stp_print_buf_init</a>();
+00071 <a class="code" href="io_8c.html#a7">_stp_print_symbol</a>(<span class="stringliteral">"%s\n"</span>, <a class="code" href="map_8h.html#a2">key1int</a>(ptr));
+00072 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"%lld\t0x%p\t(%s)\n"</span>, ptr-><a class="code" href="structmap__node__int64.html#o1">val</a>, <a class="code" href="map_8h.html#a2">key1int</a>(ptr), _stp_pbuf);
00073 }
00074
00075 <a class="code" href="map_8c.html#a8">_stp_map_del</a>(funct_locations);
00077
00078 MODULE_LICENSE(<span class="stringliteral">"GPL"</span>);
</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>
00003 <span class="comment"> * @brief Implements maps (associative arrays) and lists</span>
00004 <span class="comment"> */</span>
00005
-00006
-00007 <span class="keyword">static</span> <span class="keywordtype">int</span> map_sizes[] = {
-00008 <span class="keyword">sizeof</span>(<span class="keyword">struct </span>map_node_int64),
-00009 sizeof(struct map_node_stat),
-00010 sizeof(struct map_node_str),
-00011 0
-00012 };
-00013
-00014 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> string_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keyword">const</span> <span class="keywordtype">char</span> *key2)
-00015 {
-00016 <span class="keywordtype">int</span> hash = 0, count = 0;
-00017 <span class="keywordtype">char</span> *v1 = (<span class="keywordtype">char</span> *)key1;
-00018 <span class="keywordtype">char</span> *v2 = (<span class="keywordtype">char</span> *)key2;
-00019 <span class="keywordflow">while</span> (*v1 && count++ < 5) {
-00020 hash += *v1++;
-00021 }
-00022 <span class="keywordflow">while</span> (v2 && *v2 && count++ < 5) {
-00023 hash += *v2++;
-00024 }
-00025 <span class="keywordflow">return</span> hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)hash, HASH_TABLE_BITS);
-00026 }
-00027
-00028 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> mixed_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
-00029 {
-00030 <span class="keywordtype">int</span> hash = 0, count = 0;
-00031 <span class="keywordtype">char</span> *v = (<span class="keywordtype">char</span> *)key1;
-00032 <span class="keywordflow">while</span> (v && *v && count++ < 5)
-00033 hash += *v++;
-00034 return hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)(hash ^ key2), HASH_TABLE_BITS);
-00035 }
-00036 <span class="comment"></span>
-00037 <span class="comment">/** Create a new map.</span>
-00038 <span class="comment"> * Maps must be created at module initialization time.</span>
-00039 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
-00040 <span class="comment"> * be preallocated. If more entries are required, the oldest ones will be deleted. This makes</span>
-00041 <span class="comment"> * it effectively a circular buffer. If max_entries is 0, there will be no maximum and entries</span>
-00042 <span class="comment"> * will be allocated dynamically.</span>
-00043 <span class="comment"> * @param type Type of values stored in this map. </span>
-00044 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
-00045 <span class="comment"> */</span>
-00046
-<a name="l00047"></a><a class="code" href="map_8c.html#a3">00047</a> <a class="code" href="structmap__root.html">MAP</a> _stp_map_new(<span class="keywordtype">unsigned</span> max_entries, enum valtype type)
-00048 {
-00049 size_t size;
-00050 <a class="code" href="structmap__root.html">MAP</a> m = (<a class="code" href="structmap__root.html">MAP</a>) _stp_valloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structmap__root.html">map_root</a>));
-00051 <span class="keywordflow">if</span> (m == NULL)
-00052 <span class="keywordflow">return</span> NULL;
-00053
-00054 INIT_LIST_HEAD(&m-><a class="code" href="structmap__root.html#o4">head</a>);
-00055
-00056 m-><a class="code" href="structmap__root.html#o1">maxnum</a> = max_entries;
-00057 m-><a class="code" href="structmap__root.html#o0">type</a> = type;
-00058 <span class="keywordflow">if</span> (type >= END) {
-00059 dbug (<span class="stringliteral">"map_new: unknown type %d\n"</span>, type);
-00060 <span class="keywordflow">return</span> NULL;
-00061 }
-00062
-00063 <span class="keywordflow">if</span> (max_entries) {
-00064 <span class="keywordtype">void</span> *tmp;
-00065 <span class="keywordtype">int</span> i;
-00066 <span class="keyword">struct </span>list_head *e;
-00067
-00068 INIT_LIST_HEAD(&m-><a class="code" href="structmap__root.html#o5">pool</a>);
-00069 size = map_sizes[type];
-00070 tmp = _stp_valloc(max_entries * size);
-00071
-00072 <span class="keywordflow">for</span> (i = max_entries - 1; i >= 0; i--) {
-00073 e = i * size + tmp;
-00074 dbug (<span class="stringliteral">"e=%lx\n"</span>, (<span class="keywordtype">long</span>)e);
-00075 list_add(e, &m-><a class="code" href="structmap__root.html#o5">pool</a>);
-00076 }
-00077 m-><a class="code" href="structmap__root.html#o14">membuf</a> = tmp;
-00078 }
-00079 <span class="keywordflow">return</span> m;
-00080 }
-00081
-00082 <span class="keyword">static</span> <span class="keywordtype">void</span> map_free_strings(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *n)
-00083 {
-00084 <span class="keyword">struct </span>map_node_str *m = (<span class="keyword">struct </span>map_node_str *)n;
-00085 dbug (<span class="stringliteral">"n = %lx\n"</span>, (<span class="keywordtype">long</span>)n);
-00086 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o0">type</a> == STRING) {
-00087 dbug (<span class="stringliteral">"val STRING %lx\n"</span>, (<span class="keywordtype">long</span>)m->str);
-00088 <span class="keywordflow">if</span> (m->str)
-00089 _stp_free(m->str);
-00090 }
-00091 if (m->n.key1type == STR) {
-00092 dbug (<span class="stringliteral">"key1 STR %lx\n"</span>, (<span class="keywordtype">long</span>)key1str(m));
-00093 <span class="keywordflow">if</span> (key1str(m))
-00094 _stp_free(key1str(m));
-00095 }
-00096 if (m->n.key2type == STR) {
-00097 dbug (<span class="stringliteral">"key2 STR %lx\n"</span>, (<span class="keywordtype">long</span>)key2str(m));
-00098 <span class="keywordflow">if</span> (key2str(m))
-00099 _stp_free(key2str(m));
-00100 }
-00101 }
-00102 <span class="comment"></span>
-00103 <span class="comment">/** Deletes the current element.</span>
-00104 <span class="comment"> * If no current element (key) for this map is set, this function does nothing.</span>
-00105 <span class="comment"> * @param map </span>
-00106 <span class="comment"> */</span>
-00107
-<a name="l00108"></a><a class="code" href="map_8c.html#a5">00108</a> <span class="keywordtype">void</span> _stp_map_key_del(<a class="code" href="structmap__root.html">MAP</a> map)
-00109 {
-00110 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *m;
-00111
-00112 dbug (<span class="stringliteral">"create=%d key=%lx\n"</span>, map->create, (<span class="keywordtype">long</span>)map->key);
-00113 <span class="keywordflow">if</span> (map == NULL)
-00114 <span class="keywordflow">return</span>;
-00115
-00116 <span class="keywordflow">if</span> (map->create) {
-00117 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
-00118 map-><a class="code" href="structmap__root.html#o6">key</a> = NULL;
-00119 <span class="keywordflow">return</span>;
-00120 }
-00121
-00122 <span class="keywordflow">if</span> (map->key == NULL)
-00123 <span class="keywordflow">return</span>;
-00124
-00125 m = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map->key;
-00126
-00127 <span class="comment">/* remove node from old hash list */</span>
-00128 hlist_del_init(&m-><a class="code" href="structmap__node.html#o1">hnode</a>);
-00129
-00130 <span class="comment">/* remove from entry list */</span>
-00131 list_del(&m-><a class="code" href="structmap__node.html#o0">lnode</a>);
-00132
-00133 <span class="comment">/* remove any allocated string storage */</span>
-00134 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map->key);
-00135
-00136 <span class="keywordflow">if</span> (map->maxnum)
-00137 list_add(&m-><a class="code" href="structmap__node.html#o0">lnode</a>, &map->pool);
-00138 <span class="keywordflow">else</span>
-00139 _stp_free(m);
-00140
-00141 map->key = NULL;
-00142 map->num--;
-00143 }
-00144 <span class="comment"></span>
-00145 <span class="comment">/** Get the first element in a map.</span>
-00146 <span class="comment"> * @param map </span>
-00147 <span class="comment"> * @returns a pointer to the first element.</span>
-00148 <span class="comment"> * This is typically used with _stp_map_iter(). See the foreach() macro</span>
-00149 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
-00150 <span class="comment"> * @sa foreach</span>
-00151 <span class="comment"> */</span>
-00152
-<a name="l00153"></a><a class="code" href="map_8c.html#a6">00153</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="map_8c.html#a6">_stp_map_start</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00154 {
-00155 <span class="keywordflow">if</span> (map == NULL)
-00156 <span class="keywordflow">return</span> NULL;
-00157
-00158 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o4">head</a>.next);
-00159
-00160 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o4">head</a>))
-00161 <span class="keywordflow">return</span> NULL;
-00162
-00163 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
-00164 }
-00165 <span class="comment"></span>
-00166 <span class="comment">/** Get the next element in a map.</span>
-00167 <span class="comment"> * @param map </span>
-00168 <span class="comment"> * @param m a pointer to the current element, returned from _stp_map_start()</span>
-00169 <span class="comment"> * or _stp_map_iter().</span>
-00170 <span class="comment"> * @returns a pointer to the next element.</span>
-00171 <span class="comment"> * This is typically used with _stp_map_start(). See the foreach() macro</span>
-00172 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
-00173 <span class="comment"> * @sa foreach</span>
-00174 <span class="comment"> */</span>
-00175
-<a name="l00176"></a><a class="code" href="map_8c.html#a7">00176</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="map_8c.html#a7">_stp_map_iter</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
-00177 {
-00178 <span class="keywordflow">if</span> (map == NULL)
-00179 <span class="keywordflow">return</span> NULL;
-00180
-00181 dbug (<span class="stringliteral">"%lx next=%lx prev=%lx map->head.next=%lx\n"</span>, (<span class="keywordtype">long</span>)m,
-00182 (<span class="keywordtype">long</span>)m->lnode.next, (<span class="keywordtype">long</span>)m->lnode.prev, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o4">head</a>.next);
-00183
-00184 <span class="keywordflow">if</span> (m->lnode.next == &map-><a class="code" href="structmap__root.html#o4">head</a>)
-00185 <span class="keywordflow">return</span> NULL;
-00186
-00187 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m-><a class="code" href="structmap__node.html#o0">lnode</a>.next;
-00188 }
-00189 <span class="comment"></span>
-00190 <span class="comment">/** Deletes a map.</span>
-00191 <span class="comment"> * Deletes a map, freeing all memory in all elements. Normally done only when the module exits.</span>
-00192 <span class="comment"> * @param map</span>
-00193 <span class="comment"> */</span>
-00194
-<a name="l00195"></a><a class="code" href="map_8c.html#a8">00195</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a8">_stp_map_del</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00196 {
-00197 <span class="keywordflow">if</span> (map == NULL)
-00198 <span class="keywordflow">return</span>;
-00199
-00200 <span class="keywordflow">if</span> (!list_empty(&map-><a class="code" href="structmap__root.html#o4">head</a>)) {
-00201 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
-00202 <span class="keywordflow">while</span> (ptr && ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&map-><a class="code" href="structmap__root.html#o4">head</a>) {
-00203 map_free_strings(map, ptr);
-00204 ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-><a class="code" href="structmap__node.html#o0">lnode</a>.next;
-00205 }
-00206 }
-00207 _stp_vfree(map-><a class="code" href="structmap__root.html#o14">membuf</a>);
-00208 _stp_vfree(map);
-00209 }
-00210
-00211 <span class="comment">/********************** KEY FUNCTIONS *********************/</span>
-00212
-00213 <span class="comment"></span>
-00214 <span class="comment">/** Set the map's key to two longs.</span>
-00215 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
-00216 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
-00217 <span class="comment"> * call.</span>
-00218 <span class="comment"> * @param map</span>
-00219 <span class="comment"> * @param key1 first key</span>
-00220 <span class="comment"> * @param key2 second key</span>
-00221 <span class="comment"> */</span>
-00222
-<a name="l00223"></a><a class="code" href="map_8c.html#a9">00223</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a9">_stp_map_key_long_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">long</span> key2)
-00224 {
-00225 <span class="keywordtype">unsigned</span> hv;
-00226 <span class="keyword">struct </span>hlist_head *head;
-00227 <span class="keyword">struct </span>hlist_node *e;
-00228
-00229 <span class="keywordflow">if</span> (map == NULL)
-00230 <span class="keywordflow">return</span>;
-00231
-00232 hv = hash_long(key1 ^ key2, HASH_TABLE_BITS);
-00233 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
-00234
-00235 dbug (<span class="stringliteral">"hash for %ld,%ld is %d\n"</span>, key1, key2, hv);
-00236
-00237 hlist_for_each(e, head) {
-00238 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00239 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00240 dbug (<span class="stringliteral">"n =%lx key=%ld,%ld\n"</span>, (<span class="keywordtype">long</span>)n, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>, n->key2.<a class="code" href="unionkey__data.html#o0">val</a>);
-00241 <span class="keywordflow">if</span> (key1 == n->key1.val && key2 == n->key2.val) {
-00242 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
-00243 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00244 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
-00245 <span class="keywordflow">return</span>;
-00246 }
-00247 }
-00248
-00249 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
-00250 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
-00251 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
-00252 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
-00253 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00254 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
-00255 }
-00256 <span class="comment"></span>
-00257 <span class="comment">/** Set the map's key to two strings.</span>
-00258 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
-00259 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
-00260 <span class="comment"> * call.</span>
-00261 <span class="comment"> * @param map</span>
-00262 <span class="comment"> * @param key1 first key</span>
-00263 <span class="comment"> * @param key2 second key</span>
-00264 <span class="comment"> */</span>
-00265
-<a name="l00266"></a><a class="code" href="map_8c.html#a10">00266</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a10">_stp_map_key_str_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">char</span> *key2)
-00267 {
-00268 <span class="keywordtype">unsigned</span> hv;
-00269 <span class="keyword">struct </span>hlist_head *head;
-00270 <span class="keyword">struct </span>hlist_node *e;
-00271
-00272 <span class="keywordflow">if</span> (map == NULL)
-00273 <span class="keywordflow">return</span>;
-00274
-00275 <span class="keywordflow">if</span> (key1 == NULL) {
-00276 map-><a class="code" href="structmap__root.html#o6">key</a> = NULL;
-00277 <span class="keywordflow">return</span>;
-00278 }
-00279
-00280 hv = string_hash(key1, key2);
-00281 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
-00282
-00283 dbug (<span class="stringliteral">"hash for %s,%s is %d\n"</span>, key1, key2, hv);
-00284
-00285 hlist_for_each(e, head) {
-00286 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00287 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00288 dbug (<span class="stringliteral">"e =%lx key=%s,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00289 <span class="keywordflow">if</span> (strcmp(key1, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0
-00290 && (key2 == NULL || strcmp(key2, n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0)) {
-00291 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
-00292 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00293 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
-00294 <span class="keywordflow">return</span>;
-00295 }
-00296 }
-00297
-00298 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
-00299 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
-00300 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
-00301 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
-00302 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00303 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
-00304 }
-00305 <span class="comment"></span>
-00306 <span class="comment">/** Set the map's key to a string and a long.</span>
-00307 <span class="comment"> * This sets the current element based on a key of a string and a long. If the keys are</span>
-00308 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
-00309 <span class="comment"> * call.</span>
-00310 <span class="comment"> * @param map</span>
-00311 <span class="comment"> * @param key1 first key</span>
-00312 <span class="comment"> * @param key2 second key</span>
-00313 <span class="comment"> */</span>
-00314
-<a name="l00315"></a><a class="code" href="map_8c.html#a11">00315</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a11">_stp_map_key_str_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
-00316 {
-00317 <span class="keywordtype">unsigned</span> hv;
-00318 <span class="keyword">struct </span>hlist_head *head;
-00319 <span class="keyword">struct </span>hlist_node *e;
-00320
-00321 <span class="keywordflow">if</span> (map == NULL)
-00322 <span class="keywordflow">return</span>;
-00323
-00324 <span class="keywordflow">if</span> (key1 == NULL) {
-00325 map-><a class="code" href="structmap__root.html#o6">key</a> = NULL;
-00326 <span class="keywordflow">return</span>;
-00327 }
-00328
-00329 hv = mixed_hash(key1, key2);
-00330 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
-00331
-00332 dbug (<span class="stringliteral">"hash for %s,%ld is %d\n"</span>, key1, key2, hv);
-00333
-00334 hlist_for_each(e, head) {
-00335 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00336 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00337 dbug (<span class="stringliteral">"e =%lx key=%s,%ld\n"</span>, (<span class="keywordtype">long</span>)e, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,(<span class="keywordtype">long</span>)n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>);
-00338 <span class="keywordflow">if</span> (strcmp(key1, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0 && key2 == n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>) {
-00339 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
-00340 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00341 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
-00342 <span class="keywordflow">return</span>;
-00343 }
-00344 }
-00345
-00346 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
-00347 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
-00348 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
-00349 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
-00350 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00351 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
-00352 }
-00353 <span class="comment"></span>
-00354 <span class="comment">/** Set the map's key to a long and a string.</span>
-00355 <span class="comment"> * This sets the current element based on a key of a long and a string. If the keys are</span>
-00356 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
-00357 <span class="comment"> * call.</span>
-00358 <span class="comment"> * @param map</span>
-00359 <span class="comment"> * @param key1 first key</span>
-00360 <span class="comment"> * @param key2 second key</span>
-00361 <span class="comment"> */</span>
-00362
-<a name="l00363"></a><a class="code" href="map_8c.html#a12">00363</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a12">_stp_map_key_long_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">char</span> *key2)
-00364 {
-00365 <span class="keywordtype">unsigned</span> hv;
-00366 <span class="keyword">struct </span>hlist_head *head;
-00367 <span class="keyword">struct </span>hlist_node *e;
-00368
-00369 <span class="keywordflow">if</span> (map == NULL)
-00370 <span class="keywordflow">return</span>;
-00371
-00372 hv = mixed_hash(key2, key1);
-00373 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
-00374 dbug (<span class="stringliteral">"hash for %ld,%s is %d\n"</span>, key1, key2, hv);
-00375
-00376 hlist_for_each(e, head) {
-00377 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
-00378 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
-00379 dbug (<span class="stringliteral">"e =%lx key=%ld,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>,n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00380 <span class="keywordflow">if</span> (key1 == n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> && strcmp(key2, n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0) {
-00381 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
-00382 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00383 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
-00384 <span class="keywordflow">return</span>;
-00385 }
-00386 }
-00387
-00388 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
-00389 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
-00390 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
-00391 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
-00392 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
-00393 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
-00394 }
-00395 <span class="comment"></span>
-00396 <span class="comment">/** Set the map's key to a string.</span>
-00397 <span class="comment"> * This sets the current element based on a string key. If the key is</span>
-00398 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
-00399 <span class="comment"> * call.</span>
-00400 <span class="comment"> * @param map</span>
-00401 <span class="comment"> * @param key</span>
-00402 <span class="comment"> */</span>
-00403
-<a name="l00404"></a><a class="code" href="map_8c.html#a13">00404</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a13">_stp_map_key_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key)
-00405 {
-00406 <span class="keywordflow">if</span> (map == NULL)
-00407 <span class="keywordflow">return</span>;
-00408 <a class="code" href="map_8c.html#a10">_stp_map_key_str_str</a>(map, key, NULL);
-00409 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
-00410 }
-00411 <span class="comment"></span>
-00412 <span class="comment">/** Set the map's key to a long.</span>
-00413 <span class="comment"> * This sets the current element based on a long key. If the key is</span>
-00414 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
-00415 <span class="comment"> * call.</span>
-00416 <span class="comment"> * @param map</span>
-00417 <span class="comment"> * @param key </span>
-00418 <span class="comment"> */</span>
-00419
-<a name="l00420"></a><a class="code" href="map_8c.html#a14">00420</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key)
-00421 {
-00422 <span class="keywordflow">if</span> (map == NULL)
-00423 <span class="keywordflow">return</span>;
-00424 <a class="code" href="map_8c.html#a9">_stp_map_key_long_long</a>(map, key, 0);
-00425 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
-00426 }
-00427
-00428 <span class="comment">/********************** SET/GET VALUES *********************/</span>
-00429
-00430 <span class="keyword">static</span> <span class="keywordtype">void</span> map_copy_keys(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
-00431 {
-00432 m->key1type = map-><a class="code" href="structmap__root.html#o8">c_key1type</a>;
-00433 m->key2type = map-><a class="code" href="structmap__root.html#o9">c_key2type</a>;
-00434 <span class="keywordflow">switch</span> (map-><a class="code" href="structmap__root.html#o8">c_key1type</a>) {
-00435 <span class="keywordflow">case</span> STR:
-00436 m->key1.str = _stp_alloc(strlen(map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
-00437 strcpy(m->key1.str, map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00438 <span class="keywordflow">break</span>;
-00439 <span class="keywordflow">case</span> LONG:
-00440 m->key1.val = map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
-00441 <span class="keywordflow">break</span>;
-00442 <span class="keywordflow">case</span> NONE:
-00443 <span class="comment">/* ERROR */</span>
-00444 <span class="keywordflow">break</span>;
-00445 }
-00446 <span class="keywordflow">switch</span> (map-><a class="code" href="structmap__root.html#o9">c_key2type</a>) {
-00447 <span class="keywordflow">case</span> STR:
-00448 m->key2.<a class="code" href="unionkey__data.html#o1">str</a> = _stp_alloc(strlen(map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
-00449 strcpy(m->key2.str, map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
-00450 <span class="keywordflow">break</span>;
-00451 <span class="keywordflow">case</span> LONG:
-00452 m->key2.<a class="code" href="unionkey__data.html#o0">val</a> = map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
-00453 <span class="keywordflow">break</span>;
-00454 <span class="keywordflow">case</span> NONE:
-00455 <span class="keywordflow">break</span>;
-00456 }
-00457
-00458 <span class="comment">/* add node to new hash list */</span>
-00459 hlist_add_head(&m->hnode, map-><a class="code" href="structmap__root.html#o10">c_keyhead</a>);
-00460
-00461 map-><a class="code" href="structmap__root.html#o6">key</a> = m;
-00462 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
-00463 map-><a class="code" href="structmap__root.html#o2">num</a>++;
-00464 }
-00465
-00466 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_map_set_int64(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val, <span class="keywordtype">int</span> add)
-00467 {
-00468 <span class="keyword">struct </span>map_node_int64 *m;
-00469
-00470 <span class="keywordflow">if</span> (map == NULL)
-00471 return;
-00472
-00473 if (map->create) {
-00474 <span class="keywordflow">if</span> (val == 0)
-00475 return;
-00476
-00477 if (map->maxnum) {
-00478 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o5">pool</a>)) {
-00479 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o3">no_wrap</a>) {
-00480 <span class="comment">/* ERROR. FIXME */</span>
-00481 <span class="keywordflow">return</span>;
-00482 }
-00483 m = (<span class="keyword">struct </span>map_node_int64 *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
-00484 hlist_del_init(&m->n.hnode);
-00485 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
-00486 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
-00487 } <span class="keywordflow">else</span> {
-00488 m = (<span class="keyword">struct </span>map_node_int64 *)map-><a class="code" href="structmap__root.html#o5">pool</a>.next;
-00489 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
-00490 }
-00491 list_move_tail(&m->n.lnode, &map-><a class="code" href="structmap__root.html#o4">head</a>);
-00492 } <span class="keywordflow">else</span> {
-00493 m = (<span class="keyword">struct </span>map_node_int64 *)
-00494 _stp_calloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_int64));
-00495 <span class="comment">/* add node to list */</span>
-00496 list_add_tail(&m->n.lnode, &map-><a class="code" href="structmap__root.html#o4">head</a>);
-00497 }
-00498
-00499 <span class="comment">/* copy the key(s) */</span>
-00500 map_copy_keys(map, &m->n);
-00501
-00502 <span class="comment">/* set the value */</span>
-00503 m->val = val;
-00504 } <span class="keywordflow">else</span> {
-00505 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00506 return;
-00507
-00508 if (val) {
-00509 m = (<span class="keyword">struct </span>map_node_int64 *)map-><a class="code" href="structmap__root.html#o6">key</a>;
-00510 <span class="keywordflow">if</span> (add)
-00511 m->val += val;
-00512 else
-00513 m->val = val;
-00514 } else if (!add) {
-00515 <span class="comment">/* setting value to 0 is the same as deleting */</span>
-00516 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
-00517 }
-00518 }
-00519 }
-00520 <span class="comment"></span>
-00521 <span class="comment">/** Set the current element's value to an int64.</span>
-00522 <span class="comment"> * This sets the current element's value to an int64. The map must have been created</span>
-00523 <span class="comment"> * to hold int64s using _stp_map_new()</span>
-00524 <span class="comment"> *</span>
-00525 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00526 <span class="comment"> * is set for the map, this function does nothing.</span>
-00527 <span class="comment"> * @param map</span>
-00528 <span class="comment"> * @param val new value</span>
-00529 <span class="comment"> * @sa _stp_map_add_int64</span>
-00530 <span class="comment"> */</span>
-<a name="l00531"></a><a class="code" href="map_8c.html#a17">00531</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a17">_stp_map_set_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00532 {
-00533 __stp_map_set_int64 (map, val, 0);
-00534 }
-00535
-00536 <span class="comment"></span>
-00537 <span class="comment">/** Adds an int64 to the current element's value.</span>
-00538 <span class="comment"> * This adds an int64 to the current element's value. The map must have been created</span>
-00539 <span class="comment"> * to hold int64s using _stp_map_new()</span>
-00540 <span class="comment"> *</span>
-00541 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00542 <span class="comment"> * is set for the map, this function does nothing.</span>
-00543 <span class="comment"> * @param map</span>
-00544 <span class="comment"> * @param val value</span>
-00545 <span class="comment"> * @sa _stp_map_set_int64</span>
-00546 <span class="comment"> */</span>
-00547
-<a name="l00548"></a><a class="code" href="map_8c.html#a18">00548</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a18">_stp_map_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00549 {
-00550 __stp_map_set_int64 (map, val, 1);
-00551 }
-00552 <span class="comment"></span>
-00553 <span class="comment">/** Gets the current element's value.</span>
-00554 <span class="comment"> * @param map</span>
-00555 <span class="comment"> * @returns The value. If the current element is not set or doesn't exist, returns 0.</span>
-00556 <span class="comment"> */</span>
-00557
-<a name="l00558"></a><a class="code" href="map_8c.html#a19">00558</a> int64_t <a class="code" href="map_8c.html#a19">_stp_map_get_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00559 {
-00560 <span class="keyword">struct </span>map_node_int64 *m;
-00561 <span class="keywordflow">if</span> (map == NULL || map-><a class="code" href="structmap__root.html#o7">create</a> || map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00562 <span class="keywordflow">return</span> 0;
-00563 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00564 m = (<span class="keyword">struct </span>map_node_int64 *)map-><a class="code" href="structmap__root.html#o6">key</a>;
-00565 <span class="keywordflow">return</span> m->val;
-00566 }
-00567 <span class="comment"></span>
-00568 <span class="comment">/** Set the current element's value to a string.</span>
-00569 <span class="comment"> * This sets the current element's value to an string. The map must have been created</span>
-00570 <span class="comment"> * to hold int64s using <i>_stp_map_new(xxx, STRING)</i></span>
-00571 <span class="comment"> *</span>
-00572 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00573 <span class="comment"> * is set for the map, this function does nothing.</span>
-00574 <span class="comment"> * @param map</span>
-00575 <span class="comment"> * @param val new string</span>
-00576 <span class="comment"> */</span>
-00577
-<a name="l00578"></a><a class="code" href="map_8c.html#a20">00578</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a20">_stp_map_set_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *val)
-00579 {
-00580 <span class="keyword">struct </span>map_node_str *m;
-00581
-00582 <span class="keywordflow">if</span> (map == NULL)
-00583 <span class="keywordflow">return</span>;
-00584
-00585 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o7">create</a>) {
-00586 <span class="keywordflow">if</span> (val == NULL)
-00587 <span class="keywordflow">return</span>;
-00588
-00589 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o1">maxnum</a>) {
-00590 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o5">pool</a>)) {
-00591 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o3">no_wrap</a>) {
-00592 <span class="comment">/* ERROR. FIXME */</span>
-00593 <span class="keywordflow">return</span>;
-00594 }
-00595 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
-00596 hlist_del_init(&m->n.hnode);
-00597 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
-00598 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
-00599 } <span class="keywordflow">else</span> {
-00600 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o5">pool</a>.next;
-00601 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
-00602 }
-00603 list_move_tail(&m->n.lnode, &map-><a class="code" href="structmap__root.html#o4">head</a>);
-00604 } <span class="keywordflow">else</span> {
-00605 m = (<span class="keyword">struct </span>map_node_str *)
-00606 _stp_calloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_str));
-00607 <span class="comment">/* add node to list */</span>
-00608 list_add_tail(&m->n.lnode, &map-><a class="code" href="structmap__root.html#o4">head</a>);
-00609 }
-00610
-00611 <span class="comment">/* copy the key(s) */</span>
-00612 map_copy_keys(map, &m->n);
-00613
-00614 <span class="comment">/* set the value */</span>
-00615 m->str = _stp_alloc(strlen(val) + 1);
-00616 strcpy(m->str, val);
-00617 } <span class="keywordflow">else</span> {
-00618 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00619 <span class="keywordflow">return</span>;
-00620
-00621 <span class="keywordflow">if</span> (val) {
-00622 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o6">key</a>;
-00623 <span class="keywordflow">if</span> (m->str)
-00624 _stp_free(m->str);
-00625 m->str = _stp_alloc(strlen(val) + 1);
-00626 strcpy(m->str, val);
-00627 } <span class="keywordflow">else</span> {
-00628 <span class="comment">/* setting value to 0 is the same as deleting */</span>
-00629 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
-00630 }
-00631 }
-00632 }
-00633 <span class="comment"></span>
-00634 <span class="comment">/** Gets the current element's value.</span>
-00635 <span class="comment"> * @param map</span>
-00636 <span class="comment"> * @returns A string pointer. If the current element is not set or doesn't exist, returns NULL.</span>
-00637 <span class="comment"> */</span>
-00638
-<a name="l00639"></a><a class="code" href="map_8c.html#a21">00639</a> <span class="keywordtype">char</span> *<a class="code" href="map_8c.html#a21">_stp_map_get_str</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00640 {
-00641 <span class="keyword">struct </span>map_node_str *m;
-00642 <span class="keywordflow">if</span> (map == NULL || map-><a class="code" href="structmap__root.html#o7">create</a> || map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00643 <span class="keywordflow">return</span> NULL;
-00644 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00645 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o6">key</a>;
-00646 <span class="keywordflow">return</span> m->str;
-00647 }
-00648 <span class="comment"></span>
-00649 <span class="comment">/** Set the current element's value to a stat.</span>
-00650 <span class="comment"> * This sets the current element's value to an stat struct. The map must have been created</span>
-00651 <span class="comment"> * to hold stats using <i>_stp_map_new(xxx, STAT)</i>. This function would only be used</span>
-00652 <span class="comment"> * if we wanted to set stats to something other than the normal initial values (count = 0,</span>
-00653 <span class="comment"> * sum = 0, etc). It may be deleted if it doesn't turn out to be useful.</span>
-00654 <span class="comment"> * @sa _stp_map_stat_add </span>
-00655 <span class="comment"> *</span>
-00656 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00657 <span class="comment"> * is set for the map, this function does nothing.</span>
-00658 <span class="comment"> * @param map</span>
-00659 <span class="comment"> * @param stats pointer to stats struct.</span>
-00660 <span class="comment"> * @todo Histograms don't work yet.</span>
-00661 <span class="comment"> */</span>
-00662
-<a name="l00663"></a><a class="code" href="map_8c.html#a22">00663</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a22">_stp_map_set_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map, <a class="code" href="structstat.html">stat</a> * stats)
-00664 {
-00665 <span class="keyword">struct </span>map_node_stat *m;
-00666
-00667 <span class="keywordflow">if</span> (map == NULL)
-00668 <span class="keywordflow">return</span>;
-00669 dbug (<span class="stringliteral">"set_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00670
-00671 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o7">create</a>) {
-00672 <span class="keywordflow">if</span> (stats == NULL)
-00673 <span class="keywordflow">return</span>;
-00674
-00675 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o1">maxnum</a>) {
-00676 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o5">pool</a>)) {
-00677 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o3">no_wrap</a>) {
-00678 <span class="comment">/* ERROR. FIXME */</span>
-00679 <span class="keywordflow">return</span>;
-00680 }
-00681 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
-00682 hlist_del_init(&m->n.hnode);
-00683 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
-00684 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
-00685 } <span class="keywordflow">else</span> {
-00686 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o5">pool</a>.next;
-00687 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
-00688 }
-00689 list_move_tail(&m->n.lnode, &map-><a class="code" href="structmap__root.html#o4">head</a>);
-00690 } <span class="keywordflow">else</span> {
-00691 m = (<span class="keyword">struct </span>map_node_stat *)
-00692 _stp_calloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_stat));
-00693 <span class="comment">/* add node to list */</span>
-00694 list_add_tail(&m->n.lnode, &map-><a class="code" href="structmap__root.html#o4">head</a>);
-00695 }
-00696
-00697 <span class="comment">/* copy the key(s) */</span>
-00698 map_copy_keys(map, &m->n);
-00699
-00700 <span class="comment">/* set the value */</span>
-00701 memcpy(&m->stats, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
-00702 } <span class="keywordflow">else</span> {
-00703 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00704 <span class="keywordflow">return</span>;
-00705
-00706 <span class="keywordflow">if</span> (stats) {
-00707 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o6">key</a>;
-00708 memcpy(&m->stats, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
-00709 } <span class="keywordflow">else</span> {
-00710 <span class="comment">/* setting value to NULL is the same as deleting */</span>
-00711 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
-00712 }
-00713 }
-00714 }
-00715 <span class="comment"></span>
-00716 <span class="comment">/** Gets the current element's value.</span>
-00717 <span class="comment"> * @param map</span>
-00718 <span class="comment"> * @returns A pointer to the stats struct. If the current element is not set </span>
-00719 <span class="comment"> * or doesn't exist, returns NULL.</span>
-00720 <span class="comment"> */</span>
-00721
-<a name="l00722"></a><a class="code" href="map_8c.html#a23">00722</a> <a class="code" href="structstat.html">stat</a> *<a class="code" href="map_8c.html#a23">_stp_map_get_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00723 {
-00724 <span class="keyword">struct </span>map_node_stat *m;
-00725 <span class="keywordflow">if</span> (map == NULL || map-><a class="code" href="structmap__root.html#o7">create</a> || map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00726 <span class="keywordflow">return</span> NULL;
-00727 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00728 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o6">key</a>;
-00729 <span class="keywordflow">return</span> &m->stats;
-00730 }
-00731 <span class="comment"></span>
-00732 <span class="comment">/** Add to the current element's statistics.</span>
-00733 <span class="comment"> * Increments the statistics counter by one and the sum by <i>val</i>.</span>
-00734 <span class="comment"> * Adjusts minimum, maximum, and histogram.</span>
-00735 <span class="comment"> *</span>
-00736 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
-00737 <span class="comment"> * is set for the map, this function does nothing.</span>
-00738 <span class="comment"> * @param map</span>
-00739 <span class="comment"> * @param val value to add to the statistics</span>
-00740 <span class="comment"> * @todo Histograms don't work yet.</span>
-00741 <span class="comment"> */</span>
-00742
-<a name="l00743"></a><a class="code" href="map_8c.html#a24">00743</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a24">_stp_map_stat_add</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00744 {
-00745 <span class="keyword">struct </span>map_node_stat *m;
-00746 <span class="keywordflow">if</span> (map == NULL)
-00747 <span class="keywordflow">return</span>;
-00748
-00749 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o7">create</a>) {
-00750 <a class="code" href="structstat.html">stat</a> st = { 1, val, val, val };
-00751 <span class="comment">/* histogram */</span>
-00752 <a class="code" href="map_8c.html#a22">_stp_map_set_stat</a>(map, &st);
-00753 <span class="keywordflow">return</span>;
-00754 }
-00755
-00756 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
-00757 <span class="keywordflow">return</span>;
-00758
-00759 dbug (<span class="stringliteral">"add_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
-00760 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o6">key</a>;
-00761 m->stats.count++;
-00762 m->stats.sum += val;
-00763 <span class="keywordflow">if</span> (val > m->stats.max)
-00764 m->stats.max = val;
-00765 <span class="keywordflow">if</span> (val < m->stats.min)
-00766 m->stats.min = val;
-00767 <span class="comment">/* histogram */</span>
-00768 }
-00769
-00770 <span class="comment">/********************** List Functions *********************/</span>
-00771 <span class="comment"></span>
-00772 <span class="comment">/** Create a new list.</span>
-00773 <span class="comment"> * A list is a map that internally has an incrementing long key for each member.</span>
-00774 <span class="comment"> * Lists do not wrap if elements are added to exceed their maximum size.</span>
-00775 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
-00776 <span class="comment"> * be preallocated. If max_entries is 0, there will be no maximum and entries</span>
-00777 <span class="comment"> * will be allocated dynamically.</span>
-00778 <span class="comment"> * @param type Type of values stored in this list. </span>
-00779 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
-00780 <span class="comment"> * @sa foreach</span>
-00781 <span class="comment"> */</span>
-00782
-<a name="l00783"></a><a class="code" href="map_8c.html#a25">00783</a> <a class="code" href="structmap__root.html">MAP</a> <a class="code" href="map_8c.html#a25">_stp_list_new</a>(<span class="keywordtype">unsigned</span> max_entries, <span class="keyword">enum</span> valtype type)
-00784 {
-00785 <a class="code" href="structmap__root.html">MAP</a> map = <a class="code" href="map_8c.html#a3">_stp_map_new</a> (max_entries, type);
-00786 map-><a class="code" href="structmap__root.html#o3">no_wrap</a> = 1;
-00787 <span class="keywordflow">return</span> map;
-00788 }
-00789 <span class="comment"></span>
-00790 <span class="comment">/** Clears a list.</span>
-00791 <span class="comment"> * All elements in the list are deleted.</span>
-00792 <span class="comment"> * @param map </span>
-00793 <span class="comment"> */</span>
-00794
-<a name="l00795"></a><a class="code" href="map_8c.html#a26">00795</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a26">_stp_list_clear</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00796 {
-00797 <span class="keywordflow">if</span> (map == NULL)
-00798 <span class="keywordflow">return</span>;
-00799
-00800 <span class="keywordflow">if</span> (!list_empty(&map-><a class="code" href="structmap__root.html#o4">head</a>)) {
-00801 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
-00802
-00803 <span class="keywordflow">while</span> (ptr && ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&map-><a class="code" href="structmap__root.html#o4">head</a>) {
-00804 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *next = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-><a class="code" href="structmap__node.html#o0">lnode</a>.next;
-00805
-00806 <span class="comment">/* remove node from old hash list */</span>
-00807 hlist_del_init(&ptr-><a class="code" href="structmap__node.html#o1">hnode</a>);
-00808
-00809 <span class="comment">/* remove from entry list */</span>
-00810 list_del(&ptr-><a class="code" href="structmap__node.html#o0">lnode</a>);
-00811
-00812 <span class="comment">/* remove any allocated string storage */</span>
-00813 map_free_strings(map, ptr);
-00814
-00815 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o1">maxnum</a>)
-00816 list_add(&ptr-><a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o5">pool</a>);
-00817 <span class="keywordflow">else</span>
-00818 _stp_free(ptr);
-00819
-00820 map-><a class="code" href="structmap__root.html#o2">num</a>--;
-00821 ptr = next;
-00822 }
-00823 }
-00824
-00825 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o2">num</a> != 0) {
-00826 dlog (<span class="stringliteral">"ERROR: list is supposed to be empty (has %d)\n"</span>, map-><a class="code" href="structmap__root.html#o2">num</a>);
-00827 }
-00828 }
-00829 <span class="comment"></span>
-00830 <span class="comment">/** Adds a string to a list.</span>
-00831 <span class="comment"> * @param map</span>
-00832 <span class="comment"> * @param str</span>
-00833 <span class="comment"> */</span>
-00834
-<a name="l00835"></a><a class="code" href="map_8c.html#a27">00835</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a27">_stp_list_add_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *str)
-00836 {
-00837 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(map, map-><a class="code" href="structmap__root.html#o2">num</a>);
-00838 <a class="code" href="map_8c.html#a20">_stp_map_set_str</a>(map, str);
-00839 }
-00840 <span class="comment"></span>
-00841 <span class="comment">/** Adds an int64 to a list.</span>
-00842 <span class="comment"> * @param map</span>
-00843 <span class="comment"> * @param val</span>
-00844 <span class="comment"> */</span>
-00845
-<a name="l00846"></a><a class="code" href="map_8c.html#a28">00846</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a28">_stp_list_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
-00847 {
-00848 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(map, map-><a class="code" href="structmap__root.html#o2">num</a>);
-00849 <a class="code" href="map_8c.html#a17">_stp_map_set_int64</a>(map, val);
-00850 }
-00851 <span class="comment"></span>
-00852 <span class="comment">/** Get the number of elements in a list.</span>
-00853 <span class="comment"> * @param map</span>
-00854 <span class="comment"> * @returns The number of elements in a list.</span>
-00855 <span class="comment"> */</span>
-00856
-<a name="l00857"></a><a class="code" href="map_8c.html#a29">00857</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="map_8c.html#a29">_stp_list_size</a>(<a class="code" href="structmap__root.html">MAP</a> map)
-00858 {
-00859 <span class="keywordflow">return</span> map-><a class="code" href="structmap__root.html#o2">num</a>;
-00860 }
+00006 <span class="keyword">static</span> <span class="keywordtype">int</span> map_sizes[] = {
+00007 <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a>),
+00008 sizeof(struct map_node_stat),
+00009 sizeof(struct map_node_str),
+00010 0
+00011 };
+00012
+00013 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> string_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keyword">const</span> <span class="keywordtype">char</span> *key2)
+00014 {
+00015 <span class="keywordtype">int</span> hash = 0, count = 0;
+00016 <span class="keywordtype">char</span> *v1 = (<span class="keywordtype">char</span> *)key1;
+00017 <span class="keywordtype">char</span> *v2 = (<span class="keywordtype">char</span> *)key2;
+00018 <span class="keywordflow">while</span> (*v1 && count++ < 5) {
+00019 hash += *v1++;
+00020 }
+00021 <span class="keywordflow">while</span> (v2 && *v2 && count++ < 5) {
+00022 hash += *v2++;
+00023 }
+00024 <span class="keywordflow">return</span> hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)hash, HASH_TABLE_BITS);
+00025 }
+00026
+00027 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> mixed_hash(<span class="keyword">const</span> <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
+00028 {
+00029 <span class="keywordtype">int</span> hash = 0, count = 0;
+00030 <span class="keywordtype">char</span> *v = (<span class="keywordtype">char</span> *)key1;
+00031 <span class="keywordflow">while</span> (v && *v && count++ < 5)
+00032 hash += *v++;
+00033 return hash_long((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)(hash ^ key2), HASH_TABLE_BITS);
+00034 }
+00035 <span class="comment"></span>
+00036 <span class="comment">/** Create a new map.</span>
+00037 <span class="comment"> * Maps must be created at module initialization time.</span>
+00038 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
+00039 <span class="comment"> * be preallocated. If more entries are required, the oldest ones will be deleted. This makes</span>
+00040 <span class="comment"> * it effectively a circular buffer. If max_entries is 0, there will be no maximum and entries</span>
+00041 <span class="comment"> * will be allocated dynamically.</span>
+00042 <span class="comment"> * @param type Type of values stored in this map. </span>
+00043 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
+00044 <span class="comment"> */</span>
+00045
+<a name="l00046"></a><a class="code" href="map_8c.html#a3">00046</a> <a class="code" href="structmap__root.html">MAP</a> _stp_map_new(<span class="keywordtype">unsigned</span> max_entries, enum valtype type)
+00047 {
+00048 size_t size;
+00049 <a class="code" href="structmap__root.html">MAP</a> m = (<a class="code" href="structmap__root.html">MAP</a>) <a class="code" href="alloc_8h.html#a5">_stp_valloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structmap__root.html">map_root</a>));
+00050 <span class="keywordflow">if</span> (m == NULL)
+00051 <span class="keywordflow">return</span> NULL;
+00052
+00053 INIT_LIST_HEAD(&m-><a class="code" href="structmap__root.html#o4">head</a>);
+00054
+00055 m-><a class="code" href="structmap__root.html#o1">maxnum</a> = max_entries;
+00056 m-><a class="code" href="structmap__root.html#o0">type</a> = type;
+00057 <span class="keywordflow">if</span> (type >= END) {
+00058 dbug (<span class="stringliteral">"map_new: unknown type %d\n"</span>, type);
+00059 <span class="keywordflow">return</span> NULL;
+00060 }
+00061
+00062 <span class="keywordflow">if</span> (max_entries) {
+00063 <span class="keywordtype">void</span> *tmp;
+00064 <span class="keywordtype">int</span> i;
+00065 <span class="keyword">struct </span>list_head *e;
+00066
+00067 INIT_LIST_HEAD(&m-><a class="code" href="structmap__root.html#o5">pool</a>);
+00068 size = map_sizes[type];
+00069 tmp = <a class="code" href="alloc_8h.html#a5">_stp_valloc</a>(max_entries * size);
+00070
+00071 <span class="keywordflow">for</span> (i = max_entries - 1; i >= 0; i--) {
+00072 e = i * size + tmp;
+00073 dbug (<span class="stringliteral">"e=%lx\n"</span>, (<span class="keywordtype">long</span>)e);
+00074 list_add(e, &m-><a class="code" href="structmap__root.html#o5">pool</a>);
+00075 }
+00076 m-><a class="code" href="structmap__root.html#o14">membuf</a> = tmp;
+00077 }
+00078 <span class="keywordflow">return</span> m;
+00079 }
+00080
+00081 <span class="keyword">static</span> <span class="keywordtype">void</span> map_free_strings(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *n)
+00082 {
+00083 <span class="keyword">struct </span>map_node_str *m = (<span class="keyword">struct </span>map_node_str *)n;
+00084 dbug (<span class="stringliteral">"n = %lx\n"</span>, (<span class="keywordtype">long</span>)n);
+00085 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o0">type</a> == STRING) {
+00086 dbug (<span class="stringliteral">"val STRING %lx\n"</span>, (<span class="keywordtype">long</span>)m-><a class="code" href="structmap__node__str.html#o1">str</a>);
+00087 <span class="keywordflow">if</span> (m-><a class="code" href="structmap__node__str.html#o1">str</a>)
+00088 _stp_free(m->str);
+00089 }
+00090 if (m->n.key1type == STR) {
+00091 dbug (<span class="stringliteral">"key1 STR %lx\n"</span>, (<span class="keywordtype">long</span>)<a class="code" href="map_8h.html#a0">key1str</a>(m));
+00092 <span class="keywordflow">if</span> (<a class="code" href="map_8h.html#a0">key1str</a>(m))
+00093 _stp_free(key1str(m));
+00094 }
+00095 if (m->n.key2type == STR) {
+00096 dbug (<span class="stringliteral">"key2 STR %lx\n"</span>, (<span class="keywordtype">long</span>)<a class="code" href="map_8h.html#a1">key2str</a>(m));
+00097 <span class="keywordflow">if</span> (<a class="code" href="map_8h.html#a1">key2str</a>(m))
+00098 _stp_free(key2str(m));
+00099 }
+00100 }
+00101 <span class="comment"></span>
+00102 <span class="comment">/** Deletes the current element.</span>
+00103 <span class="comment"> * If no current element (key) for this map is set, this function does nothing.</span>
+00104 <span class="comment"> * @param map </span>
+00105 <span class="comment"> */</span>
+00106
+<a name="l00107"></a><a class="code" href="map_8c.html#a5">00107</a> <span class="keywordtype">void</span> _stp_map_key_del(<a class="code" href="structmap__root.html">MAP</a> map)
+00108 {
+00109 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *m;
+00110
+00111 dbug (<span class="stringliteral">"create=%d key=%lx\n"</span>, map->create, (<span class="keywordtype">long</span>)map->key);
+00112 <span class="keywordflow">if</span> (map == NULL)
+00113 <span class="keywordflow">return</span>;
+00114
+00115 <span class="keywordflow">if</span> (map->create) {
+00116 map->create = 0;
+00117 map->key = NULL;
+00118 <span class="keywordflow">return</span>;
+00119 }
+00120
+00121 <span class="keywordflow">if</span> (map->key == NULL)
+00122 <span class="keywordflow">return</span>;
+00123
+00124 m = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map->key;
+00125
+00126 <span class="comment">/* remove node from old hash list */</span>
+00127 hlist_del_init(&m-><a class="code" href="structmap__node.html#o1">hnode</a>);
+00128
+00129 <span class="comment">/* remove from entry list */</span>
+00130 list_del(&m-><a class="code" href="structmap__node.html#o0">lnode</a>);
+00131
+00132 <span class="comment">/* remove any allocated string storage */</span>
+00133 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map->key);
+00134
+00135 <span class="keywordflow">if</span> (map->maxnum)
+00136 list_add(&m-><a class="code" href="structmap__node.html#o0">lnode</a>, &map->pool);
+00137 <span class="keywordflow">else</span>
+00138 <a class="code" href="alloc_8h.html#a6">_stp_free</a>(m);
+00139
+00140 map->key = NULL;
+00141 map->num--;
+00142 }
+00143 <span class="comment"></span>
+00144 <span class="comment">/** Get the first element in a map.</span>
+00145 <span class="comment"> * @param map </span>
+00146 <span class="comment"> * @returns a pointer to the first element.</span>
+00147 <span class="comment"> * This is typically used with _stp_map_iter(). See the foreach() macro</span>
+00148 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
+00149 <span class="comment"> * @sa foreach</span>
+00150 <span class="comment"> */</span>
+00151
+<a name="l00152"></a><a class="code" href="map_8c.html#a6">00152</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="map_8c.html#a6">_stp_map_start</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00153 {
+00154 <span class="keywordflow">if</span> (map == NULL)
+00155 <span class="keywordflow">return</span> NULL;
+00156
+00157 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o4">head</a>.next);
+00158
+00159 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o4">head</a>))
+00160 <span class="keywordflow">return</span> NULL;
+00161
+00162 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
+00163 }
+00164 <span class="comment"></span>
+00165 <span class="comment">/** Get the next element in a map.</span>
+00166 <span class="comment"> * @param map </span>
+00167 <span class="comment"> * @param m a pointer to the current element, returned from _stp_map_start()</span>
+00168 <span class="comment"> * or _stp_map_iter().</span>
+00169 <span class="comment"> * @returns a pointer to the next element.</span>
+00170 <span class="comment"> * This is typically used with _stp_map_start(). See the foreach() macro</span>
+00171 <span class="comment"> * for typical usage. It probably does what you want anyway.</span>
+00172 <span class="comment"> * @sa foreach</span>
+00173 <span class="comment"> */</span>
+00174
+<a name="l00175"></a><a class="code" href="map_8c.html#a7">00175</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="map_8c.html#a7">_stp_map_iter</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
+00176 {
+00177 <span class="keywordflow">if</span> (map == NULL)
+00178 <span class="keywordflow">return</span> NULL;
+00179
+00180 dbug (<span class="stringliteral">"%lx next=%lx prev=%lx map->head.next=%lx\n"</span>, (<span class="keywordtype">long</span>)m,
+00181 (<span class="keywordtype">long</span>)m->lnode.next, (<span class="keywordtype">long</span>)m->lnode.prev, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o4">head</a>.next);
+00182
+00183 <span class="keywordflow">if</span> (m->lnode.next == &map-><a class="code" href="structmap__root.html#o4">head</a>)
+00184 <span class="keywordflow">return</span> NULL;
+00185
+00186 <span class="keywordflow">return</span> (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m-><a class="code" href="structmap__node.html#o0">lnode</a>.next;
+00187 }
+00188 <span class="comment"></span>
+00189 <span class="comment">/** Deletes a map.</span>
+00190 <span class="comment"> * Deletes a map, freeing all memory in all elements. Normally done only when the module exits.</span>
+00191 <span class="comment"> * @param map</span>
+00192 <span class="comment"> */</span>
+00193
+<a name="l00194"></a><a class="code" href="map_8c.html#a8">00194</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a8">_stp_map_del</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00195 {
+00196 <span class="keywordflow">if</span> (map == NULL)
+00197 <span class="keywordflow">return</span>;
+00198
+00199 <span class="keywordflow">if</span> (!list_empty(&map-><a class="code" href="structmap__root.html#o4">head</a>)) {
+00200 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
+00201 <span class="keywordflow">while</span> (ptr && ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&map-><a class="code" href="structmap__root.html#o4">head</a>) {
+00202 map_free_strings(map, ptr);
+00203 ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-><a class="code" href="structmap__node.html#o0">lnode</a>.next;
+00204 }
+00205 }
+00206 <a class="code" href="alloc_8h.html#a7">_stp_vfree</a>(map-><a class="code" href="structmap__root.html#o14">membuf</a>);
+00207 <a class="code" href="alloc_8h.html#a7">_stp_vfree</a>(map);
+00208 }
+00209
+00210 <span class="comment">/********************** KEY FUNCTIONS *********************/</span>
+00211
+00212 <span class="comment"></span>
+00213 <span class="comment">/** Set the map's key to two longs.</span>
+00214 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
+00215 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
+00216 <span class="comment"> * call.</span>
+00217 <span class="comment"> * @param map</span>
+00218 <span class="comment"> * @param key1 first key</span>
+00219 <span class="comment"> * @param key2 second key</span>
+00220 <span class="comment"> */</span>
+00221
+<a name="l00222"></a><a class="code" href="map_8c.html#a9">00222</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a9">_stp_map_key_long_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">long</span> key2)
+00223 {
+00224 <span class="keywordtype">unsigned</span> hv;
+00225 <span class="keyword">struct </span>hlist_head *head;
+00226 <span class="keyword">struct </span>hlist_node *e;
+00227
+00228 <span class="keywordflow">if</span> (map == NULL)
+00229 <span class="keywordflow">return</span>;
+00230
+00231 hv = hash_long(key1 ^ key2, HASH_TABLE_BITS);
+00232 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00233
+00234 dbug (<span class="stringliteral">"hash for %ld,%ld is %d\n"</span>, key1, key2, hv);
+00235
+00236 hlist_for_each(e, head) {
+00237 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00238 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00239 dbug (<span class="stringliteral">"n =%lx key=%ld,%ld\n"</span>, (<span class="keywordtype">long</span>)n, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>, n->key2.<a class="code" href="unionkey__data.html#o0">val</a>);
+00240 <span class="keywordflow">if</span> (key1 == n->key1.val && key2 == n->key2.val) {
+00241 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
+00242 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00243 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
+00244 <span class="keywordflow">return</span>;
+00245 }
+00246 }
+00247
+00248 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
+00249 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
+00250 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
+00251 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
+00252 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00253 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
+00254 }
+00255 <span class="comment"></span>
+00256 <span class="comment">/** Set the map's key to two strings.</span>
+00257 <span class="comment"> * This sets the current element based on a key of two strings. If the keys are</span>
+00258 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
+00259 <span class="comment"> * call.</span>
+00260 <span class="comment"> * @param map</span>
+00261 <span class="comment"> * @param key1 first key</span>
+00262 <span class="comment"> * @param key2 second key</span>
+00263 <span class="comment"> */</span>
+00264
+<a name="l00265"></a><a class="code" href="map_8c.html#a10">00265</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a10">_stp_map_key_str_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">char</span> *key2)
+00266 {
+00267 <span class="keywordtype">unsigned</span> hv;
+00268 <span class="keyword">struct </span>hlist_head *head;
+00269 <span class="keyword">struct </span>hlist_node *e;
+00270
+00271 <span class="keywordflow">if</span> (map == NULL)
+00272 <span class="keywordflow">return</span>;
+00273
+00274 <span class="keywordflow">if</span> (key1 == NULL) {
+00275 map-><a class="code" href="structmap__root.html#o6">key</a> = NULL;
+00276 <span class="keywordflow">return</span>;
+00277 }
+00278
+00279 hv = string_hash(key1, key2);
+00280 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00281
+00282 dbug (<span class="stringliteral">"hash for %s,%s is %d\n"</span>, key1, key2, hv);
+00283
+00284 hlist_for_each(e, head) {
+00285 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00286 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00287 dbug (<span class="stringliteral">"e =%lx key=%s,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00288 <span class="keywordflow">if</span> (strcmp(key1, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0
+00289 && (key2 == NULL || strcmp(key2, n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0)) {
+00290 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
+00291 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00292 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
+00293 <span class="keywordflow">return</span>;
+00294 }
+00295 }
+00296
+00297 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
+00298 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
+00299 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
+00300 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
+00301 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00302 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
+00303 }
+00304 <span class="comment"></span>
+00305 <span class="comment">/** Set the map's key to a string and a long.</span>
+00306 <span class="comment"> * This sets the current element based on a key of a string and a long. If the keys are</span>
+00307 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
+00308 <span class="comment"> * call.</span>
+00309 <span class="comment"> * @param map</span>
+00310 <span class="comment"> * @param key1 first key</span>
+00311 <span class="comment"> * @param key2 second key</span>
+00312 <span class="comment"> */</span>
+00313
+<a name="l00314"></a><a class="code" href="map_8c.html#a11">00314</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a11">_stp_map_key_str_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key1, <span class="keywordtype">long</span> key2)
+00315 {
+00316 <span class="keywordtype">unsigned</span> hv;
+00317 <span class="keyword">struct </span>hlist_head *head;
+00318 <span class="keyword">struct </span>hlist_node *e;
+00319
+00320 <span class="keywordflow">if</span> (map == NULL)
+00321 <span class="keywordflow">return</span>;
+00322
+00323 <span class="keywordflow">if</span> (key1 == NULL) {
+00324 map-><a class="code" href="structmap__root.html#o6">key</a> = NULL;
+00325 <span class="keywordflow">return</span>;
+00326 }
+00327
+00328 hv = mixed_hash(key1, key2);
+00329 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00330
+00331 dbug (<span class="stringliteral">"hash for %s,%ld is %d\n"</span>, key1, key2, hv);
+00332
+00333 hlist_for_each(e, head) {
+00334 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00335 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00336 dbug (<span class="stringliteral">"e =%lx key=%s,%ld\n"</span>, (<span class="keywordtype">long</span>)e, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>,(<span class="keywordtype">long</span>)n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>);
+00337 <span class="keywordflow">if</span> (strcmp(key1, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0 && key2 == n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>) {
+00338 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
+00339 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00340 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
+00341 <span class="keywordflow">return</span>;
+00342 }
+00343 }
+00344
+00345 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key1;
+00346 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key2;
+00347 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = STR;
+00348 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = LONG;
+00349 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00350 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
+00351 }
+00352 <span class="comment"></span>
+00353 <span class="comment">/** Set the map's key to a long and a string.</span>
+00354 <span class="comment"> * This sets the current element based on a key of a long and a string. If the keys are</span>
+00355 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
+00356 <span class="comment"> * call.</span>
+00357 <span class="comment"> * @param map</span>
+00358 <span class="comment"> * @param key1 first key</span>
+00359 <span class="comment"> * @param key2 second key</span>
+00360 <span class="comment"> */</span>
+00361
+<a name="l00362"></a><a class="code" href="map_8c.html#a12">00362</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a12">_stp_map_key_long_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key1, <span class="keywordtype">char</span> *key2)
+00363 {
+00364 <span class="keywordtype">unsigned</span> hv;
+00365 <span class="keyword">struct </span>hlist_head *head;
+00366 <span class="keyword">struct </span>hlist_node *e;
+00367
+00368 <span class="keywordflow">if</span> (map == NULL)
+00369 <span class="keywordflow">return</span>;
+00370
+00371 hv = mixed_hash(key2, key1);
+00372 head = &map-><a class="code" href="structmap__root.html#o13">hashes</a>[hv];
+00373 dbug (<span class="stringliteral">"hash for %ld,%s is %d\n"</span>, key1, key2, hv);
+00374
+00375 hlist_for_each(e, head) {
+00376 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *n =
+00377 (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)((long)e - <span class="keyword">sizeof</span>(<span class="keyword">struct </span>hlist_node));
+00378 dbug (<span class="stringliteral">"e =%lx key=%ld,%s\n"</span>, (<span class="keywordtype">long</span>)e, n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>,n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00379 <span class="keywordflow">if</span> (key1 == n-><a class="code" href="structmap__node.html#o2">key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> && strcmp(key2, n-><a class="code" href="structmap__node.html#o3">key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) == 0) {
+00380 map-><a class="code" href="structmap__root.html#o6">key</a> = n;
+00381 dbug (<span class="stringliteral">"saving key %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00382 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
+00383 <span class="keywordflow">return</span>;
+00384 }
+00385 }
+00386
+00387 map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a> = key1;
+00388 map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a> = key2;
+00389 map-><a class="code" href="structmap__root.html#o8">c_key1type</a> = LONG;
+00390 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = STR;
+00391 map-><a class="code" href="structmap__root.html#o10">c_keyhead</a> = head;
+00392 map-><a class="code" href="structmap__root.html#o7">create</a> = 1;
+00393 }
+00394 <span class="comment"></span>
+00395 <span class="comment">/** Set the map's key to a string.</span>
+00396 <span class="comment"> * This sets the current element based on a string key. If the key is</span>
+00397 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
+00398 <span class="comment"> * call.</span>
+00399 <span class="comment"> * @param map</span>
+00400 <span class="comment"> * @param key</span>
+00401 <span class="comment"> */</span>
+00402
+<a name="l00403"></a><a class="code" href="map_8c.html#a13">00403</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a13">_stp_map_key_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *key)
+00404 {
+00405 <span class="keywordflow">if</span> (map == NULL)
+00406 <span class="keywordflow">return</span>;
+00407 <a class="code" href="map_8c.html#a10">_stp_map_key_str_str</a>(map, key, NULL);
+00408 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
+00409 }
+00410 <span class="comment"></span>
+00411 <span class="comment">/** Set the map's key to a long.</span>
+00412 <span class="comment"> * This sets the current element based on a long key. If the key is</span>
+00413 <span class="comment"> * not found, a new element will not be created until a <i>_stp_map_set_xxx</i></span>
+00414 <span class="comment"> * call.</span>
+00415 <span class="comment"> * @param map</span>
+00416 <span class="comment"> * @param key </span>
+00417 <span class="comment"> */</span>
+00418
+<a name="l00419"></a><a class="code" href="map_8c.html#a14">00419</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">long</span> key)
+00420 {
+00421 <span class="keywordflow">if</span> (map == NULL)
+00422 <span class="keywordflow">return</span>;
+00423 <a class="code" href="map_8c.html#a9">_stp_map_key_long_long</a>(map, key, 0);
+00424 map-><a class="code" href="structmap__root.html#o9">c_key2type</a> = NONE;
+00425 }
+00426
+00427 <span class="comment">/********************** SET/GET VALUES *********************/</span>
+00428
+00429 <span class="keyword">static</span> <span class="keywordtype">void</span> map_copy_keys(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *m)
+00430 {
+00431 m->key1type = map-><a class="code" href="structmap__root.html#o8">c_key1type</a>;
+00432 m->key2type = map-><a class="code" href="structmap__root.html#o9">c_key2type</a>;
+00433 <span class="keywordflow">switch</span> (map-><a class="code" href="structmap__root.html#o8">c_key1type</a>) {
+00434 <span class="keywordflow">case</span> STR:
+00435 m->key1.str = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
+00436 strcpy(m->key1.str, map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00437 <span class="keywordflow">break</span>;
+00438 <span class="keywordflow">case</span> LONG:
+00439 m->key1.val = map-><a class="code" href="structmap__root.html#o11">c_key1</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
+00440 <span class="keywordflow">break</span>;
+00441 <span class="keywordflow">case</span> NONE:
+00442 <span class="comment">/* ERROR */</span>
+00443 <span class="keywordflow">break</span>;
+00444 }
+00445 <span class="keywordflow">switch</span> (map-><a class="code" href="structmap__root.html#o9">c_key2type</a>) {
+00446 <span class="keywordflow">case</span> STR:
+00447 m->key2.<a class="code" href="unionkey__data.html#o1">str</a> = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>) + 1);
+00448 strcpy(m->key2.str, map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o1">str</a>);
+00449 <span class="keywordflow">break</span>;
+00450 <span class="keywordflow">case</span> LONG:
+00451 m->key2.<a class="code" href="unionkey__data.html#o0">val</a> = map-><a class="code" href="structmap__root.html#o12">c_key2</a>.<a class="code" href="unionkey__data.html#o0">val</a>;
+00452 <span class="keywordflow">break</span>;
+00453 <span class="keywordflow">case</span> NONE:
+00454 <span class="keywordflow">break</span>;
+00455 }
+00456
+00457 <span class="comment">/* add node to new hash list */</span>
+00458 hlist_add_head(&m->hnode, map-><a class="code" href="structmap__root.html#o10">c_keyhead</a>);
+00459
+00460 map-><a class="code" href="structmap__root.html#o6">key</a> = m;
+00461 map-><a class="code" href="structmap__root.html#o7">create</a> = 0;
+00462 map-><a class="code" href="structmap__root.html#o2">num</a>++;
+00463 }
+00464
+00465 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_map_set_int64(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val, <span class="keywordtype">int</span> add)
+00466 {
+00467 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *m;
+00468
+00469 <span class="keywordflow">if</span> (map == NULL)
+00470 return;
+00471
+00472 if (map->create) {
+00473 <span class="keywordflow">if</span> (val == 0)
+00474 return;
+00475
+00476 if (map->maxnum) {
+00477 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o5">pool</a>)) {
+00478 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o3">no_wrap</a>) {
+00479 <span class="comment">/* ERROR. FIXME */</span>
+00480 <span class="keywordflow">return</span>;
+00481 }
+00482 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
+00483 hlist_del_init(&m-><a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
+00484 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
+00485 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
+00486 } <span class="keywordflow">else</span> {
+00487 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-><a class="code" href="structmap__root.html#o5">pool</a>.next;
+00488 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
+00489 }
+00490 list_move_tail(&m-><a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o4">head</a>);
+00491 } <span class="keywordflow">else</span> {
+00492 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)
+00493 <a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structmap__node__int64.html">map_node_int64</a>));
+00494 <span class="comment">/* add node to list */</span>
+00495 list_add_tail(&m-><a class="code" href="structmap__node__int64.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o4">head</a>);
+00496 }
+00497
+00498 <span class="comment">/* copy the key(s) */</span>
+00499 map_copy_keys(map, &m-><a class="code" href="structmap__node__int64.html#o0">n</a>);
+00500
+00501 <span class="comment">/* set the value */</span>
+00502 m-><a class="code" href="structmap__node__int64.html#o1">val</a> = val;
+00503 } <span class="keywordflow">else</span> {
+00504 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00505 return;
+00506
+00507 if (val) {
+00508 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-><a class="code" href="structmap__root.html#o6">key</a>;
+00509 <span class="keywordflow">if</span> (add)
+00510 m->val += val;
+00511 else
+00512 m->val = val;
+00513 } else if (!add) {
+00514 <span class="comment">/* setting value to 0 is the same as deleting */</span>
+00515 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
+00516 }
+00517 }
+00518 }
+00519 <span class="comment"></span>
+00520 <span class="comment">/** Set the current element's value to an int64.</span>
+00521 <span class="comment"> * This sets the current element's value to an int64. The map must have been created</span>
+00522 <span class="comment"> * to hold int64s using _stp_map_new()</span>
+00523 <span class="comment"> *</span>
+00524 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00525 <span class="comment"> * is set for the map, this function does nothing.</span>
+00526 <span class="comment"> * @param map</span>
+00527 <span class="comment"> * @param val new value</span>
+00528 <span class="comment"> * @sa _stp_map_add_int64</span>
+00529 <span class="comment"> */</span>
+<a name="l00530"></a><a class="code" href="map_8c.html#a17">00530</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a17">_stp_map_set_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00531 {
+00532 __stp_map_set_int64 (map, val, 0);
+00533 }
+00534
+00535 <span class="comment"></span>
+00536 <span class="comment">/** Adds an int64 to the current element's value.</span>
+00537 <span class="comment"> * This adds an int64 to the current element's value. The map must have been created</span>
+00538 <span class="comment"> * to hold int64s using _stp_map_new()</span>
+00539 <span class="comment"> *</span>
+00540 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00541 <span class="comment"> * is set for the map, this function does nothing.</span>
+00542 <span class="comment"> * @param map</span>
+00543 <span class="comment"> * @param val value</span>
+00544 <span class="comment"> * @sa _stp_map_set_int64</span>
+00545 <span class="comment"> */</span>
+00546
+<a name="l00547"></a><a class="code" href="map_8c.html#a18">00547</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a18">_stp_map_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00548 {
+00549 __stp_map_set_int64 (map, val, 1);
+00550 }
+00551 <span class="comment"></span>
+00552 <span class="comment">/** Gets the current element's value.</span>
+00553 <span class="comment"> * @param map</span>
+00554 <span class="comment"> * @returns The value. If the current element is not set or doesn't exist, returns 0.</span>
+00555 <span class="comment"> */</span>
+00556
+<a name="l00557"></a><a class="code" href="map_8c.html#a19">00557</a> int64_t <a class="code" href="map_8c.html#a19">_stp_map_get_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00558 {
+00559 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *m;
+00560 <span class="keywordflow">if</span> (map == NULL || map-><a class="code" href="structmap__root.html#o7">create</a> || map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00561 <span class="keywordflow">return</span> 0;
+00562 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00563 m = (<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *)map-><a class="code" href="structmap__root.html#o6">key</a>;
+00564 <span class="keywordflow">return</span> m-><a class="code" href="structmap__node__int64.html#o1">val</a>;
+00565 }
+00566 <span class="comment"></span>
+00567 <span class="comment">/** Set the current element's value to a string.</span>
+00568 <span class="comment"> * This sets the current element's value to an string. The map must have been created</span>
+00569 <span class="comment"> * to hold int64s using <i>_stp_map_new(xxx, STRING)</i></span>
+00570 <span class="comment"> *</span>
+00571 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00572 <span class="comment"> * is set for the map, this function does nothing.</span>
+00573 <span class="comment"> * @param map</span>
+00574 <span class="comment"> * @param val new string</span>
+00575 <span class="comment"> */</span>
+00576
+<a name="l00577"></a><a class="code" href="map_8c.html#a20">00577</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a20">_stp_map_set_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *val)
+00578 {
+00579 <span class="keyword">struct </span>map_node_str *m;
+00580
+00581 <span class="keywordflow">if</span> (map == NULL)
+00582 <span class="keywordflow">return</span>;
+00583
+00584 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o7">create</a>) {
+00585 <span class="keywordflow">if</span> (val == NULL)
+00586 <span class="keywordflow">return</span>;
+00587
+00588 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o1">maxnum</a>) {
+00589 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o5">pool</a>)) {
+00590 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o3">no_wrap</a>) {
+00591 <span class="comment">/* ERROR. FIXME */</span>
+00592 <span class="keywordflow">return</span>;
+00593 }
+00594 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
+00595 hlist_del_init(&m-><a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
+00596 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
+00597 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
+00598 } <span class="keywordflow">else</span> {
+00599 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o5">pool</a>.next;
+00600 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
+00601 }
+00602 list_move_tail(&m-><a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o4">head</a>);
+00603 } <span class="keywordflow">else</span> {
+00604 m = (<span class="keyword">struct </span>map_node_str *)
+00605 <a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_str));
+00606 <span class="comment">/* add node to list */</span>
+00607 list_add_tail(&m-><a class="code" href="structmap__node__str.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o4">head</a>);
+00608 }
+00609
+00610 <span class="comment">/* copy the key(s) */</span>
+00611 map_copy_keys(map, &m-><a class="code" href="structmap__node__str.html#o0">n</a>);
+00612
+00613 <span class="comment">/* set the value */</span>
+00614 m-><a class="code" href="structmap__node__str.html#o1">str</a> = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(val) + 1);
+00615 strcpy(m-><a class="code" href="structmap__node__str.html#o1">str</a>, val);
+00616 } <span class="keywordflow">else</span> {
+00617 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00618 <span class="keywordflow">return</span>;
+00619
+00620 <span class="keywordflow">if</span> (val) {
+00621 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o6">key</a>;
+00622 <span class="keywordflow">if</span> (m-><a class="code" href="structmap__node__str.html#o1">str</a>)
+00623 <a class="code" href="alloc_8h.html#a6">_stp_free</a>(m-><a class="code" href="structmap__node__str.html#o1">str</a>);
+00624 m-><a class="code" href="structmap__node__str.html#o1">str</a> = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(strlen(val) + 1);
+00625 strcpy(m-><a class="code" href="structmap__node__str.html#o1">str</a>, val);
+00626 } <span class="keywordflow">else</span> {
+00627 <span class="comment">/* setting value to 0 is the same as deleting */</span>
+00628 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
+00629 }
+00630 }
+00631 }
+00632 <span class="comment"></span>
+00633 <span class="comment">/** Gets the current element's value.</span>
+00634 <span class="comment"> * @param map</span>
+00635 <span class="comment"> * @returns A string pointer. If the current element is not set or doesn't exist, returns NULL.</span>
+00636 <span class="comment"> */</span>
+00637
+<a name="l00638"></a><a class="code" href="map_8c.html#a21">00638</a> <span class="keywordtype">char</span> *<a class="code" href="map_8c.html#a21">_stp_map_get_str</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00639 {
+00640 <span class="keyword">struct </span>map_node_str *m;
+00641 <span class="keywordflow">if</span> (map == NULL || map-><a class="code" href="structmap__root.html#o7">create</a> || map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00642 <span class="keywordflow">return</span> NULL;
+00643 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00644 m = (<span class="keyword">struct </span>map_node_str *)map-><a class="code" href="structmap__root.html#o6">key</a>;
+00645 <span class="keywordflow">return</span> m-><a class="code" href="structmap__node__str.html#o1">str</a>;
+00646 }
+00647 <span class="comment"></span>
+00648 <span class="comment">/** Set the current element's value to a stat.</span>
+00649 <span class="comment"> * This sets the current element's value to an stat struct. The map must have been created</span>
+00650 <span class="comment"> * to hold stats using <i>_stp_map_new(xxx, STAT)</i>. This function would only be used</span>
+00651 <span class="comment"> * if we wanted to set stats to something other than the normal initial values (count = 0,</span>
+00652 <span class="comment"> * sum = 0, etc). It may be deleted if it doesn't turn out to be useful.</span>
+00653 <span class="comment"> * @sa _stp_map_stat_add </span>
+00654 <span class="comment"> *</span>
+00655 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00656 <span class="comment"> * is set for the map, this function does nothing.</span>
+00657 <span class="comment"> * @param map</span>
+00658 <span class="comment"> * @param stats pointer to stats struct.</span>
+00659 <span class="comment"> * @todo Histograms don't work yet.</span>
+00660 <span class="comment"> */</span>
+00661
+<a name="l00662"></a><a class="code" href="map_8c.html#a22">00662</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a22">_stp_map_set_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map, <a class="code" href="structstat.html">stat</a> * stats)
+00663 {
+00664 <span class="keyword">struct </span>map_node_stat *m;
+00665
+00666 <span class="keywordflow">if</span> (map == NULL)
+00667 <span class="keywordflow">return</span>;
+00668 dbug (<span class="stringliteral">"set_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00669
+00670 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o7">create</a>) {
+00671 <span class="keywordflow">if</span> (stats == NULL)
+00672 <span class="keywordflow">return</span>;
+00673
+00674 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o1">maxnum</a>) {
+00675 <span class="keywordflow">if</span> (list_empty(&map-><a class="code" href="structmap__root.html#o5">pool</a>)) {
+00676 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o3">no_wrap</a>) {
+00677 <span class="comment">/* ERROR. FIXME */</span>
+00678 <span class="keywordflow">return</span>;
+00679 }
+00680 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
+00681 hlist_del_init(&m-><a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o1">hnode</a>);
+00682 map_free_strings(map, (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)m);
+00683 dbug (<span class="stringliteral">"got %lx off head\n"</span>, (<span class="keywordtype">long</span>)m);
+00684 } <span class="keywordflow">else</span> {
+00685 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o5">pool</a>.next;
+00686 dbug (<span class="stringliteral">"got %lx off pool\n"</span>, (<span class="keywordtype">long</span>)m);
+00687 }
+00688 list_move_tail(&m-><a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o4">head</a>);
+00689 } <span class="keywordflow">else</span> {
+00690 m = (<span class="keyword">struct </span>map_node_stat *)
+00691 <a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> map_node_stat));
+00692 <span class="comment">/* add node to list */</span>
+00693 list_add_tail(&m-><a class="code" href="structmap__node__stat.html#o0">n</a>.<a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o4">head</a>);
+00694 }
+00695
+00696 <span class="comment">/* copy the key(s) */</span>
+00697 map_copy_keys(map, &m-><a class="code" href="structmap__node__stat.html#o0">n</a>);
+00698
+00699 <span class="comment">/* set the value */</span>
+00700 memcpy(&m-><a class="code" href="structmap__node__stat.html#o1">stats</a>, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
+00701 } <span class="keywordflow">else</span> {
+00702 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00703 <span class="keywordflow">return</span>;
+00704
+00705 <span class="keywordflow">if</span> (stats) {
+00706 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o6">key</a>;
+00707 memcpy(&m-><a class="code" href="structmap__node__stat.html#o1">stats</a>, stats, <span class="keyword">sizeof</span>(<a class="code" href="structstat.html">stat</a>));
+00708 } <span class="keywordflow">else</span> {
+00709 <span class="comment">/* setting value to NULL is the same as deleting */</span>
+00710 <a class="code" href="map_8c.html#a5">_stp_map_key_del</a>(map);
+00711 }
+00712 }
+00713 }
+00714 <span class="comment"></span>
+00715 <span class="comment">/** Gets the current element's value.</span>
+00716 <span class="comment"> * @param map</span>
+00717 <span class="comment"> * @returns A pointer to the stats struct. If the current element is not set </span>
+00718 <span class="comment"> * or doesn't exist, returns NULL.</span>
+00719 <span class="comment"> */</span>
+00720
+<a name="l00721"></a><a class="code" href="map_8c.html#a23">00721</a> <a class="code" href="structstat.html">stat</a> *<a class="code" href="map_8c.html#a23">_stp_map_get_stat</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00722 {
+00723 <span class="keyword">struct </span>map_node_stat *m;
+00724 <span class="keywordflow">if</span> (map == NULL || map-><a class="code" href="structmap__root.html#o7">create</a> || map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00725 <span class="keywordflow">return</span> NULL;
+00726 dbug (<span class="stringliteral">"%lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00727 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o6">key</a>;
+00728 <span class="keywordflow">return</span> &m-><a class="code" href="structmap__node__stat.html#o1">stats</a>;
+00729 }
+00730 <span class="comment"></span>
+00731 <span class="comment">/** Add to the current element's statistics.</span>
+00732 <span class="comment"> * Increments the statistics counter by one and the sum by <i>val</i>.</span>
+00733 <span class="comment"> * Adjusts minimum, maximum, and histogram.</span>
+00734 <span class="comment"> *</span>
+00735 <span class="comment"> * If the element doesn't exist, it is created. If no current element (key)</span>
+00736 <span class="comment"> * is set for the map, this function does nothing.</span>
+00737 <span class="comment"> * @param map</span>
+00738 <span class="comment"> * @param val value to add to the statistics</span>
+00739 <span class="comment"> * @todo Histograms don't work yet.</span>
+00740 <span class="comment"> */</span>
+00741
+<a name="l00742"></a><a class="code" href="map_8c.html#a24">00742</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a24">_stp_map_stat_add</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00743 {
+00744 <span class="keyword">struct </span>map_node_stat *m;
+00745 <span class="keywordflow">if</span> (map == NULL)
+00746 <span class="keywordflow">return</span>;
+00747
+00748 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o7">create</a>) {
+00749 <a class="code" href="structstat.html">stat</a> st = { 1, val, val, val };
+00750 <span class="comment">/* histogram */</span>
+00751 <a class="code" href="map_8c.html#a22">_stp_map_set_stat</a>(map, &st);
+00752 <span class="keywordflow">return</span>;
+00753 }
+00754
+00755 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o6">key</a> == NULL)
+00756 <span class="keywordflow">return</span>;
+00757
+00758 dbug (<span class="stringliteral">"add_stat %lx\n"</span>, (<span class="keywordtype">long</span>)map-><a class="code" href="structmap__root.html#o6">key</a>);
+00759 m = (<span class="keyword">struct </span>map_node_stat *)map-><a class="code" href="structmap__root.html#o6">key</a>;
+00760 m-><a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o0">count</a>++;
+00761 m-><a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o1">sum</a> += val;
+00762 <span class="keywordflow">if</span> (val > m-><a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o3">max</a>)
+00763 m-><a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o3">max</a> = val;
+00764 <span class="keywordflow">if</span> (val < m->stats.min)
+00765 m-><a class="code" href="structmap__node__stat.html#o1">stats</a>.<a class="code" href="structstat.html#o2">min</a> = val;
+00766 <span class="comment">/* histogram */</span>
+00767 }
+00768
+00769 <span class="comment">/********************** List Functions *********************/</span>
+00770 <span class="comment"></span>
+00771 <span class="comment">/** Create a new list.</span>
+00772 <span class="comment"> * A list is a map that internally has an incrementing long key for each member.</span>
+00773 <span class="comment"> * Lists do not wrap if elements are added to exceed their maximum size.</span>
+00774 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that number will</span>
+00775 <span class="comment"> * be preallocated. If max_entries is 0, there will be no maximum and entries</span>
+00776 <span class="comment"> * will be allocated dynamically.</span>
+00777 <span class="comment"> * @param type Type of values stored in this list. </span>
+00778 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
+00779 <span class="comment"> * @sa foreach</span>
+00780 <span class="comment"> */</span>
+00781
+<a name="l00782"></a><a class="code" href="map_8c.html#a25">00782</a> <a class="code" href="structmap__root.html">MAP</a> <a class="code" href="map_8c.html#a25">_stp_list_new</a>(<span class="keywordtype">unsigned</span> max_entries, <span class="keyword">enum</span> valtype type)
+00783 {
+00784 <a class="code" href="structmap__root.html">MAP</a> map = <a class="code" href="map_8c.html#a3">_stp_map_new</a> (max_entries, type);
+00785 map-><a class="code" href="structmap__root.html#o3">no_wrap</a> = 1;
+00786 <span class="keywordflow">return</span> map;
+00787 }
+00788 <span class="comment"></span>
+00789 <span class="comment">/** Clears a list.</span>
+00790 <span class="comment"> * All elements in the list are deleted.</span>
+00791 <span class="comment"> * @param map </span>
+00792 <span class="comment"> */</span>
+00793
+<a name="l00794"></a><a class="code" href="map_8c.html#a26">00794</a> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a26">_stp_list_clear</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00795 {
+00796 <span class="keywordflow">if</span> (map == NULL)
+00797 <span class="keywordflow">return</span>;
+00798
+00799 <span class="keywordflow">if</span> (!list_empty(&map-><a class="code" href="structmap__root.html#o4">head</a>)) {
+00800 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *ptr = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)map-><a class="code" href="structmap__root.html#o4">head</a>.next;
+00801
+00802 <span class="keywordflow">while</span> (ptr && ptr != (<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)&map-><a class="code" href="structmap__root.html#o4">head</a>) {
+00803 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *next = (<span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *)ptr-><a class="code" href="structmap__node.html#o0">lnode</a>.next;
+00804
+00805 <span class="comment">/* remove node from old hash list */</span>
+00806 hlist_del_init(&ptr-><a class="code" href="structmap__node.html#o1">hnode</a>);
+00807
+00808 <span class="comment">/* remove from entry list */</span>
+00809 list_del(&ptr-><a class="code" href="structmap__node.html#o0">lnode</a>);
+00810
+00811 <span class="comment">/* remove any allocated string storage */</span>
+00812 map_free_strings(map, ptr);
+00813
+00814 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o1">maxnum</a>)
+00815 list_add(&ptr-><a class="code" href="structmap__node.html#o0">lnode</a>, &map-><a class="code" href="structmap__root.html#o5">pool</a>);
+00816 <span class="keywordflow">else</span>
+00817 <a class="code" href="alloc_8h.html#a6">_stp_free</a>(ptr);
+00818
+00819 map-><a class="code" href="structmap__root.html#o2">num</a>--;
+00820 ptr = next;
+00821 }
+00822 }
+00823
+00824 <span class="keywordflow">if</span> (map-><a class="code" href="structmap__root.html#o2">num</a> != 0) {
+00825 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"ERROR: list is supposed to be empty (has %d)\n"</span>, map-><a class="code" href="structmap__root.html#o2">num</a>);
+00826 }
+00827 }
+00828 <span class="comment"></span>
+00829 <span class="comment">/** Adds a string to a list.</span>
+00830 <span class="comment"> * @param map</span>
+00831 <span class="comment"> * @param str</span>
+00832 <span class="comment"> */</span>
+00833
+<a name="l00834"></a><a class="code" href="map_8c.html#a27">00834</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a27">_stp_list_add_str</a>(<a class="code" href="structmap__root.html">MAP</a> map, <span class="keywordtype">char</span> *str)
+00835 {
+00836 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(map, map-><a class="code" href="structmap__root.html#o2">num</a>);
+00837 <a class="code" href="map_8c.html#a20">_stp_map_set_str</a>(map, str);
+00838 }
+00839 <span class="comment"></span>
+00840 <span class="comment">/** Adds an int64 to a list.</span>
+00841 <span class="comment"> * @param map</span>
+00842 <span class="comment"> * @param val</span>
+00843 <span class="comment"> */</span>
+00844
+<a name="l00845"></a><a class="code" href="map_8c.html#a28">00845</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="map_8c.html#a28">_stp_list_add_int64</a>(<a class="code" href="structmap__root.html">MAP</a> map, int64_t val)
+00846 {
+00847 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a>(map, map-><a class="code" href="structmap__root.html#o2">num</a>);
+00848 <a class="code" href="map_8c.html#a17">_stp_map_set_int64</a>(map, val);
+00849 }
+00850 <span class="comment"></span>
+00851 <span class="comment">/** Get the number of elements in a list.</span>
+00852 <span class="comment"> * @param map</span>
+00853 <span class="comment"> * @returns The number of elements in a list.</span>
+00854 <span class="comment"> */</span>
+00855
+<a name="l00856"></a><a class="code" href="map_8c.html#a29">00856</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="map_8c.html#a29">_stp_list_size</a>(<a class="code" href="structmap__root.html">MAP</a> map)
+00857 {
+00858 <span class="keywordflow">return</span> map-><a class="code" href="structmap__root.html#o2">num</a>;
+00859 }
</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>
<a href="map_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structmap__root.html">MAP</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a3">_stp_map_new</a> (unsigned max_entries, enum valtype type)</td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a1" doxytag="map.c::string_hash"></a>
+static unsigned </td><td class="memItemRight" valign="bottom"><b>string_hash</b> (const char *key1, const char *key2)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2" doxytag="map.c::mixed_hash"></a>
+static unsigned </td><td class="memItemRight" valign="bottom"><b>mixed_hash</b> (const char *key1, long key2)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structmap__root.html">MAP</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a3">_stp_map_new</a> (unsigned max_entries, enum <a class="el" href="map_8h.html#a19">valtype</a> type)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a new map. <a href="#a3"></a><br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a4" doxytag="map.c::map_free_strings"></a>
+static void </td><td class="memItemRight" valign="bottom"><b>map_free_strings</b> (<a class="el" href="structmap__root.html">MAP</a> map, struct <a class="el" href="structmap__node.html">map_node</a> *n)</td></tr>
+
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a5">_stp_map_key_del</a> (<a class="el" href="structmap__root.html">MAP</a> map)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Deletes the current element. <a href="#a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a14">_stp_map_key_long</a> (<a class="el" href="structmap__root.html">MAP</a> map, long key)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the map's key to a long. <a href="#a14"></a><br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a15" doxytag="map.c::map_copy_keys"></a>
+static void </td><td class="memItemRight" valign="bottom"><b>map_copy_keys</b> (<a class="el" href="structmap__root.html">MAP</a> map, struct <a class="el" href="structmap__node.html">map_node</a> *m)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a16" doxytag="map.c::__stp_map_set_int64"></a>
+static void </td><td class="memItemRight" valign="bottom"><b>__stp_map_set_int64</b> (<a class="el" href="structmap__root.html">MAP</a> map, int64_t val, int add)</td></tr>
+
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a17">_stp_map_set_int64</a> (<a class="el" href="structmap__root.html">MAP</a> map, int64_t val)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the current element's value to an int64. <a href="#a17"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a24">_stp_map_stat_add</a> (<a class="el" href="structmap__root.html">MAP</a> map, int64_t val)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Add to the current element's statistics. <a href="#a24"></a><br></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structmap__root.html">MAP</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a25">_stp_list_new</a> (unsigned max_entries, enum valtype type)</td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structmap__root.html">MAP</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a25">_stp_list_new</a> (unsigned max_entries, enum <a class="el" href="map_8h.html#a19">valtype</a> type)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a new list. <a href="#a25"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a26">_stp_list_clear</a> (<a class="el" href="structmap__root.html">MAP</a> map)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8c.html#a29">_stp_list_size</a> (<a class="el" href="structmap__root.html">MAP</a> map)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the number of elements in a list. <a href="#a29"></a><br></td></tr>
+<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><b>map_sizes</b> []</td></tr>
+
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Implements maps (associative arrays) and lists.
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00846">846</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00845">845</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00420">_stp_map_key_long()</a>, <a class="el" href="map_8c-source.html#l00531">_stp_map_set_int64()</a>, and <a class="el" href="map_8h-source.html#l00062">map_root::num</a>. </td>
+References <a class="el" href="map_8c-source.html#l00419">_stp_map_key_long()</a>, <a class="el" href="map_8c-source.html#l00530">_stp_map_set_int64()</a>, and <a class="el" href="map_8h-source.html#l00069">map_root::num</a>. </td>
</tr>
</table>
<a class="anchor" name="a27" doxytag="map.c::_stp_list_add_str"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00835">835</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00834">834</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00420">_stp_map_key_long()</a>, <a class="el" href="map_8c-source.html#l00578">_stp_map_set_str()</a>, and <a class="el" href="map_8h-source.html#l00062">map_root::num</a>. </td>
+References <a class="el" href="map_8c-source.html#l00419">_stp_map_key_long()</a>, <a class="el" href="map_8c-source.html#l00577">_stp_map_set_str()</a>, and <a class="el" href="map_8h-source.html#l00069">map_root::num</a>.
+<p>
+Referenced by <a class="el" href="copy_8c-source.html#l00119">_stp_copy_argv_from_user()</a>. </td>
</tr>
</table>
<a class="anchor" name="a26" doxytag="map.c::_stp_list_clear"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00795">795</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00794">794</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00068">map_root::head</a>, <a class="el" href="map_8h-source.html#l00031">map_node::hnode</a>, <a class="el" href="map_8h-source.html#l00030">map_node::lnode</a>, <a class="el" href="map_8h-source.html#l00059">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00062">map_root::num</a>, and <a class="el" href="map_8h-source.html#l00072">map_root::pool</a>. </td>
+References <a class="el" href="alloc_8h-source.html#l00063">_stp_free()</a>, <a class="el" href="io_8c-source.html#l00016">dlog()</a>, <a class="el" href="map_8h-source.html#l00075">map_root::head</a>, <a class="el" href="map_8h-source.html#l00033">map_node::hnode</a>, <a class="el" href="map_8h-source.html#l00031">map_node::lnode</a>, <a class="el" href="map_8h-source.html#l00066">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00069">map_root::num</a>, and <a class="el" href="map_8h-source.html#l00079">map_root::pool</a>. </td>
</tr>
</table>
<a class="anchor" name="a25" doxytag="map.c::_stp_list_new"></a><p>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
- <td class="md" nowrap>enum valtype </td>
+ <td class="md" nowrap>enum <a class="el" href="map_8h.html#a19">valtype</a> </td>
<td class="mdname" nowrap> <em>type</em></td>
</tr>
<tr>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="map_8h.html#a8">foreach</a> </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00783">783</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00782">782</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00047">_stp_map_new()</a>, and <a class="el" href="map_8h-source.html#l00065">map_root::no_wrap</a>. </td>
+References <a class="el" href="map_8c-source.html#l00046">_stp_map_new()</a>, and <a class="el" href="map_8h-source.html#l00072">map_root::no_wrap</a>. </td>
</tr>
</table>
<a class="anchor" name="a29" doxytag="map.c::_stp_list_size"></a><p>
<dl compact><dt><b>Returns:</b></dt><dd>The number of elements in a list. </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00857">857</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00856">856</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00062">map_root::num</a>. </td>
+References <a class="el" href="map_8h-source.html#l00069">map_root::num</a>. </td>
</tr>
</table>
<a class="anchor" name="a18" doxytag="map.c::_stp_map_add_int64"></a><p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="map_8c.html#a17">_stp_map_set_int64</a> </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00548">548</a> of file <a class="el" href="map_8c-source.html">map.c</a>. </td>
+Definition at line <a class="el" href="map_8c-source.html#l00547">547</a> of file <a class="el" href="map_8c-source.html">map.c</a>. </td>
</tr>
</table>
<a class="anchor" name="a8" doxytag="map.c::_stp_map_del"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00195">195</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00194">194</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00068">map_root::head</a>, <a class="el" href="map_8h-source.html#l00030">map_node::lnode</a>, and <a class="el" href="map_8h-source.html#l00090">map_root::membuf</a>. </td>
+References <a class="el" href="alloc_8h-source.html#l00073">_stp_vfree()</a>, <a class="el" href="map_8h-source.html#l00075">map_root::head</a>, <a class="el" href="map_8h-source.html#l00031">map_node::lnode</a>, and <a class="el" href="map_8h-source.html#l00098">map_root::membuf</a>. </td>
</tr>
</table>
<a class="anchor" name="a19" doxytag="map.c::_stp_map_get_int64"></a><p>
<dl compact><dt><b>Returns:</b></dt><dd>The value. If the current element is not set or doesn't exist, returns 0. </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00558">558</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00557">557</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, and <a class="el" href="map_8h-source.html#l00075">map_root::key</a>. </td>
+References <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, and <a class="el" href="map_8h-source.html#l00043">map_node_int64::val</a>. </td>
</tr>
</table>
<a class="anchor" name="a23" doxytag="map.c::_stp_map_get_stat"></a><p>
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to the stats struct. If the current element is not set or doesn't exist, returns NULL. </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00722">722</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00721">721</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, and <a class="el" href="map_8h-source.html#l00075">map_root::key</a>. </td>
+References <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, and <a class="el" href="map_8h-source.html#l00055">map_node_stat::stats</a>. </td>
</tr>
</table>
<a class="anchor" name="a21" doxytag="map.c::_stp_map_get_str"></a><p>
<dl compact><dt><b>Returns:</b></dt><dd>A string pointer. If the current element is not set or doesn't exist, returns NULL. </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00639">639</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00638">638</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, and <a class="el" href="map_8h-source.html#l00075">map_root::key</a>. </td>
+References <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, and <a class="el" href="map_8h-source.html#l00049">map_node_str::str</a>. </td>
</tr>
</table>
<a class="anchor" name="a7" doxytag="map.c::_stp_map_iter"></a><p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="map_8h.html#a8">foreach</a> </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00176">176</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00175">175</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00068">map_root::head</a>, and <a class="el" href="map_8h-source.html#l00030">map_node::lnode</a>. </td>
+References <a class="el" href="map_8h-source.html#l00075">map_root::head</a>, and <a class="el" href="map_8h-source.html#l00031">map_node::lnode</a>. </td>
</tr>
</table>
<a class="anchor" name="a5" doxytag="map.c::_stp_map_key_del"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00108">108</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00107">107</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, <a class="el" href="map_8h-source.html#l00031">map_node::hnode</a>, <a class="el" href="map_8h-source.html#l00075">map_root::key</a>, and <a class="el" href="map_8h-source.html#l00030">map_node::lnode</a>.
+References <a class="el" href="alloc_8h-source.html#l00063">_stp_free()</a>, <a class="el" href="map_8h-source.html#l00033">map_node::hnode</a>, and <a class="el" href="map_8h-source.html#l00031">map_node::lnode</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00663">_stp_map_set_stat()</a>, and <a class="el" href="map_8c-source.html#l00578">_stp_map_set_str()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00662">_stp_map_set_stat()</a>, and <a class="el" href="map_8c-source.html#l00577">_stp_map_set_str()</a>. </td>
</tr>
</table>
<a class="anchor" name="a14" doxytag="map.c::_stp_map_key_long"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00420">420</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00419">419</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00223">_stp_map_key_long_long()</a>, and <a class="el" href="map_8h-source.html#l00081">map_root::c_key2type</a>.
+References <a class="el" href="map_8c-source.html#l00222">_stp_map_key_long_long()</a>, and <a class="el" href="map_8h-source.html#l00089">map_root::c_key2type</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00846">_stp_list_add_int64()</a>, and <a class="el" href="map_8c-source.html#l00835">_stp_list_add_str()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00845">_stp_list_add_int64()</a>, and <a class="el" href="map_8c-source.html#l00834">_stp_list_add_str()</a>. </td>
</tr>
</table>
<a class="anchor" name="a9" doxytag="map.c::_stp_map_key_long_long"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00223">223</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00222">222</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00083">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00080">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00084">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00081">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00082">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, <a class="el" href="map_8h-source.html#l00087">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00075">map_root::key</a>, <a class="el" href="map_8h-source.html#l00032">map_node::key1</a>, and <a class="el" href="map_8h-source.html#l00020">key_data::val</a>.
+References <a class="el" href="map_8h-source.html#l00091">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00088">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00092">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00089">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00090">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00095">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, <a class="el" href="map_8h-source.html#l00034">map_node::key1</a>, and <a class="el" href="map_8h-source.html#l00018">key_data::val</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00420">_stp_map_key_long()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00419">_stp_map_key_long()</a>. </td>
</tr>
</table>
<a class="anchor" name="a12" doxytag="map.c::_stp_map_key_long_str"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00363">363</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00362">362</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00083">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00080">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00084">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00081">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00082">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, <a class="el" href="map_8h-source.html#l00087">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00075">map_root::key</a>, <a class="el" href="map_8h-source.html#l00032">map_node::key1</a>, <a class="el" href="map_8h-source.html#l00033">map_node::key2</a>, <a class="el" href="map_8h-source.html#l00021">key_data::str</a>, and <a class="el" href="map_8h-source.html#l00020">key_data::val</a>. </td>
+References <a class="el" href="map_8h-source.html#l00091">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00088">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00092">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00089">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00090">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00095">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, <a class="el" href="map_8h-source.html#l00034">map_node::key1</a>, <a class="el" href="map_8h-source.html#l00035">map_node::key2</a>, <a class="el" href="map_8h-source.html#l00019">key_data::str</a>, and <a class="el" href="map_8h-source.html#l00018">key_data::val</a>. </td>
</tr>
</table>
<a class="anchor" name="a13" doxytag="map.c::_stp_map_key_str"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00404">404</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00403">403</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00266">_stp_map_key_str_str()</a>, and <a class="el" href="map_8h-source.html#l00081">map_root::c_key2type</a>. </td>
+References <a class="el" href="map_8c-source.html#l00265">_stp_map_key_str_str()</a>, and <a class="el" href="map_8h-source.html#l00089">map_root::c_key2type</a>. </td>
</tr>
</table>
<a class="anchor" name="a11" doxytag="map.c::_stp_map_key_str_long"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00315">315</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00314">314</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00083">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00080">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00084">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00081">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00082">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, <a class="el" href="map_8h-source.html#l00087">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00075">map_root::key</a>, <a class="el" href="map_8h-source.html#l00032">map_node::key1</a>, <a class="el" href="map_8h-source.html#l00033">map_node::key2</a>, <a class="el" href="map_8h-source.html#l00021">key_data::str</a>, and <a class="el" href="map_8h-source.html#l00020">key_data::val</a>. </td>
+References <a class="el" href="map_8h-source.html#l00091">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00088">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00092">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00089">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00090">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00095">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, <a class="el" href="map_8h-source.html#l00034">map_node::key1</a>, <a class="el" href="map_8h-source.html#l00035">map_node::key2</a>, <a class="el" href="map_8h-source.html#l00019">key_data::str</a>, and <a class="el" href="map_8h-source.html#l00018">key_data::val</a>. </td>
</tr>
</table>
<a class="anchor" name="a10" doxytag="map.c::_stp_map_key_str_str"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00266">266</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00265">265</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00083">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00080">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00084">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00081">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00082">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, <a class="el" href="map_8h-source.html#l00087">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00075">map_root::key</a>, <a class="el" href="map_8h-source.html#l00032">map_node::key1</a>, <a class="el" href="map_8h-source.html#l00033">map_node::key2</a>, and <a class="el" href="map_8h-source.html#l00021">key_data::str</a>.
+References <a class="el" href="map_8h-source.html#l00091">map_root::c_key1</a>, <a class="el" href="map_8h-source.html#l00088">map_root::c_key1type</a>, <a class="el" href="map_8h-source.html#l00092">map_root::c_key2</a>, <a class="el" href="map_8h-source.html#l00089">map_root::c_key2type</a>, <a class="el" href="map_8h-source.html#l00090">map_root::c_keyhead</a>, <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00095">map_root::hashes</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, <a class="el" href="map_8h-source.html#l00034">map_node::key1</a>, <a class="el" href="map_8h-source.html#l00035">map_node::key2</a>, and <a class="el" href="map_8h-source.html#l00019">key_data::str</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00404">_stp_map_key_str()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00403">_stp_map_key_str()</a>. </td>
</tr>
</table>
<a class="anchor" name="a3" doxytag="map.c::_stp_map_new"></a><p>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
- <td class="md" nowrap>enum valtype </td>
+ <td class="md" nowrap>enum <a class="el" href="map_8h.html#a19">valtype</a> </td>
<td class="mdname" nowrap> <em>type</em></td>
</tr>
<tr>
<dl compact><dt><b>Returns:</b></dt><dd>A MAP on success or NULL on failure. </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00047">47</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00046">46</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00068">map_root::head</a>, <a class="el" href="map_8h-source.html#l00059">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00090">map_root::membuf</a>, <a class="el" href="map_8h-source.html#l00072">map_root::pool</a>, and <a class="el" href="map_8h-source.html#l00058">map_root::type</a>.
+References <a class="el" href="alloc_8h-source.html#l00049">_stp_valloc()</a>, <a class="el" href="map_8h-source.html#l00075">map_root::head</a>, <a class="el" href="map_8h-source.html#l00066">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00098">map_root::membuf</a>, <a class="el" href="map_8h-source.html#l00079">map_root::pool</a>, and <a class="el" href="map_8h-source.html#l00063">map_root::type</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00783">_stp_list_new()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00782">_stp_list_new()</a>. </td>
</tr>
</table>
<a class="anchor" name="a17" doxytag="map.c::_stp_map_set_int64"></a><p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="map_8c.html#a18">_stp_map_add_int64</a> </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00531">531</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00530">530</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00846">_stp_list_add_int64()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00845">_stp_list_add_int64()</a>. </td>
</tr>
</table>
<a class="anchor" name="a22" doxytag="map.c::_stp_map_set_stat"></a><p>
<tr><td valign="top"></td><td valign="top"><em>stats</em> </td><td>pointer to stats struct. </td></tr>
</table>
</dl>
-<dl compact><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>Histograms don't work yet. </dd></dl>
+<dl compact><dt><b><a class="el" href="todo.html#_todo000003">Todo:</a></b></dt><dd>Histograms don't work yet. </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00663">663</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00662">662</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00108">_stp_map_key_del()</a>, <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, <a class="el" href="map_8h-source.html#l00068">map_root::head</a>, <a class="el" href="map_8h-source.html#l00075">map_root::key</a>, <a class="el" href="map_8h-source.html#l00059">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00065">map_root::no_wrap</a>, and <a class="el" href="map_8h-source.html#l00072">map_root::pool</a>.
+References <a class="el" href="alloc_8h-source.html#l00034">_stp_calloc()</a>, <a class="el" href="map_8c-source.html#l00107">_stp_map_key_del()</a>, <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00075">map_root::head</a>, <a class="el" href="map_8h-source.html#l00033">map_node::hnode</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, <a class="el" href="map_8h-source.html#l00031">map_node::lnode</a>, <a class="el" href="map_8h-source.html#l00066">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00054">map_node_stat::n</a>, <a class="el" href="map_8h-source.html#l00072">map_root::no_wrap</a>, <a class="el" href="map_8h-source.html#l00079">map_root::pool</a>, and <a class="el" href="map_8h-source.html#l00055">map_node_stat::stats</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00743">_stp_map_stat_add()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00742">_stp_map_stat_add()</a>. </td>
</tr>
</table>
<a class="anchor" name="a20" doxytag="map.c::_stp_map_set_str"></a><p>
</dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00578">578</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00577">577</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8c-source.html#l00108">_stp_map_key_del()</a>, <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, <a class="el" href="map_8h-source.html#l00068">map_root::head</a>, <a class="el" href="map_8h-source.html#l00075">map_root::key</a>, <a class="el" href="map_8h-source.html#l00059">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00065">map_root::no_wrap</a>, and <a class="el" href="map_8h-source.html#l00072">map_root::pool</a>.
+References <a class="el" href="alloc_8h-source.html#l00018">_stp_alloc()</a>, <a class="el" href="alloc_8h-source.html#l00034">_stp_calloc()</a>, <a class="el" href="alloc_8h-source.html#l00063">_stp_free()</a>, <a class="el" href="map_8c-source.html#l00107">_stp_map_key_del()</a>, <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00075">map_root::head</a>, <a class="el" href="map_8h-source.html#l00033">map_node::hnode</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, <a class="el" href="map_8h-source.html#l00031">map_node::lnode</a>, <a class="el" href="map_8h-source.html#l00066">map_root::maxnum</a>, <a class="el" href="map_8h-source.html#l00048">map_node_str::n</a>, <a class="el" href="map_8h-source.html#l00072">map_root::no_wrap</a>, <a class="el" href="map_8h-source.html#l00079">map_root::pool</a>, and <a class="el" href="map_8h-source.html#l00049">map_node_str::str</a>.
<p>
-Referenced by <a class="el" href="map_8c-source.html#l00835">_stp_list_add_str()</a>. </td>
+Referenced by <a class="el" href="map_8c-source.html#l00834">_stp_list_add_str()</a>. </td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="map.c::_stp_map_start"></a><p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="map_8h.html#a8">foreach</a> </dd></dl>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00153">153</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+Definition at line <a class="el" href="map_8c-source.html#l00152">152</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
<p>
-References <a class="el" href="map_8h-source.html#l00068">map_root::head</a>. </td>
+References <a class="el" href="map_8h-source.html#l00075">map_root::head</a>. </td>
</tr>
</table>
<a class="anchor" name="a24" doxytag="map.c::_stp_map_stat_add"></a><p>
<tr><td valign="top"></td><td valign="top"><em>val</em> </td><td>value to add to the statistics </td></tr>
</table>
</dl>
-<dl compact><dt><b><a class="el" href="todo.html#_todo000003">Todo:</a></b></dt><dd>Histograms don't work yet. </dd></dl>
+<dl compact><dt><b><a class="el" href="todo.html#_todo000004">Todo:</a></b></dt><dd>Histograms don't work yet. </dd></dl>
+
+<p>
+Definition at line <a class="el" href="map_8c-source.html#l00742">742</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+<p>
+References <a class="el" href="map_8c-source.html#l00662">_stp_map_set_stat()</a>, <a class="el" href="map_8h-source.html#l00010">stat::count</a>, <a class="el" href="map_8h-source.html#l00087">map_root::create</a>, <a class="el" href="map_8h-source.html#l00082">map_root::key</a>, <a class="el" href="map_8h-source.html#l00012">stat::max</a>, <a class="el" href="map_8h-source.html#l00012">stat::min</a>, <a class="el" href="map_8h-source.html#l00055">map_node_stat::stats</a>, and <a class="el" href="map_8h-source.html#l00011">stat::sum</a>. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a0" doxytag="map.c::map_sizes"></a><p>
+<table class="mdTable" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top">int map_sizes[]<code> [static]</code> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing="5" cellpadding="0" border="0">
+ <tr>
+ <td>
+
+ </td>
+ <td>
<p>
-Definition at line <a class="el" href="map_8c-source.html#l00743">743</a> of file <a class="el" href="map_8c-source.html">map.c</a>.
+<b>Initial value:</b><div class="fragment"><pre class="fragment"> {
+ <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a>),
+ sizeof(struct map_node_stat),
+ sizeof(struct map_node_str),
+ 0
+}
+</pre></div>
<p>
-References <a class="el" href="map_8c-source.html#l00663">_stp_map_set_stat()</a>, <a class="el" href="map_8h-source.html#l00079">map_root::create</a>, and <a class="el" href="map_8h-source.html#l00075">map_root::key</a>. </td>
+Definition at line <a class="el" href="map_8c-source.html#l00006">6</a> of file <a class="el" href="map_8c-source.html">map.c</a>. </td>
</tr>
</table>
<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>
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>map.h</h1><a href="map_8h.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 map.h</span>
-00003 <span class="comment"> * @brief Header file for maps and lists</span>
+00003 <span class="comment"> * @brief Header file for maps and lists</span>
00004 <span class="comment"> */</span>
00005
00006 <span class="preprocessor">#include <linux/types.h></span>
00007 <span class="comment"></span>
-00008 <span class="comment">/** Statistics are stored in this struct</span>
-00009 <span class="comment">*/</span>
-<a name="l00010"></a><a class="code" href="structstat.html">00010</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
-00011 int64_t count;
-00012 int64_t sum;
-00013 int64_t min, max;
-00014 int64_t histogram[BUCKETS];
-00015 } <a class="code" href="structstat.html">stat</a>;
-00016 <span class="comment"></span>
-00017 <span class="comment">/** Keys are either longs or char *</span>
-00018 <span class="comment"> */</span>
-<a name="l00019"></a><a class="code" href="unionkey__data.html">00019</a> <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> {
-00020 <span class="keywordtype">long</span> val;
-00021 <span class="keywordtype">char</span> *str;
-00022 };
-00023
-00024 <span class="keyword">enum</span> keytype { NONE, LONG, STR } __attribute__ ((packed));
-00025 <span class="keyword">enum</span> valtype { INT64, STAT, STRING, END };
-00026 <span class="comment"></span>
-00027 <span class="comment">/** all map nodes have the following structure </span>
-00028 <span class="comment">*/</span>
-<a name="l00029"></a><a class="code" href="structmap__node.html">00029</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> {
-00030 <span class="keyword">struct </span>list_head lnode;
-00031 <span class="keyword">struct </span>hlist_node hnode;
-00032 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key1;
-00033 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key2;
-00034 <span class="keyword">enum</span> keytype key1type;
-00035 <span class="keyword">enum</span> keytype key2type;
-00036 };
-00037
-00038 <span class="comment">/* specific map nodes with data attached */</span>
-00039 <span class="keyword">struct </span>map_node_int64 {
-00040 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n;
-00041 int64_t val;
-00042 };
-00043
-00044 <span class="keyword">struct </span>map_node_str {
-00045 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n;
-00046 <span class="keywordtype">char</span> *str;
-00047 };
-00048
-00049 <span class="keyword">struct </span>map_node_stat {
-00050 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n;
-00051 <a class="code" href="structstat.html">stat</a> stats;
-00052 };
-00053 <span class="comment"></span>
-00054 <span class="comment">/** This structure contains all information about a map.</span>
-00055 <span class="comment"> * It is allocated once when _stp_map_new() is called.</span>
-00056 <span class="comment"> */</span>
-<a name="l00057"></a><a class="code" href="structmap__root.html">00057</a> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> {
-00058 <span class="keyword">enum</span> valtype type; <span class="comment">/** type of the values stored in the array */</span>
-<a name="l00059"></a><a class="code" href="structmap__root.html#o1">00059</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o1">maxnum</a>; <span class="comment">/** maximum number of elements allowed in the array. */</span>
-00060
-00061 <span class="comment">/* current number of elements */</span>
-<a name="l00062"></a><a class="code" href="structmap__root.html#o2">00062</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o2">num</a>;
-00063
-00064 <span class="comment">/* when more than maxnum elements, wrap or discard */</span>
-00065 <span class="keywordtype">int</span> no_wrap;
-00066
-00067 <span class="comment">/* linked list of current entries */</span>
-00068 <span class="keyword">struct </span>list_head head;
-00069
-00070 <span class="comment">/* pool of unused entries. Used only when entries are statically allocated */</span>
-00071 <span class="comment">/* at startup. */</span>
-00072 <span class="keyword">struct </span>list_head pool;
-00073
-00074 <span class="comment">/* saved key entry for lookups */</span>
-00075 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *key;
-00076
-00077 <span class="comment">/* this is the creation data saved between the key functions and the */</span>
-00078 <span class="comment">/* set/get functions */</span>
-00079 u_int8_t create;
-00080 <span class="keyword">enum</span> keytype c_key1type;
-00081 <span class="keyword">enum</span> keytype c_key2type;
-00082 <span class="keyword">struct </span>hlist_head *c_keyhead;
-00083 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key1;
-00084 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key2;
-00085
-00086 <span class="comment">/* the hash table for this array */</span>
-00087 <span class="keyword">struct </span>hlist_head hashes[HASH_TABLE_SIZE];
-00088
-00089 <span class="comment">/* pointer to allocated memory space */</span>
-00090 <span class="keywordtype">void</span> *membuf;
-00091 };
-00092 <span class="comment"></span>
-00093 <span class="comment">/** All maps are of this type.</span>
-00094 <span class="comment"> */</span>
-<a name="l00095"></a><a class="code" href="map_8h.html#a10">00095</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> *<a class="code" href="structmap__root.html">MAP</a>;
-00096
-00097 <span class="preprocessor">#define key1str(ptr) (ptr->n.key1.str)</span>
-00098 <span class="preprocessor"></span><span class="preprocessor">#define key2str(ptr) (ptr->n.key2.str)</span>
-00099 <span class="preprocessor"></span><span class="preprocessor">#define key1int(ptr) (ptr->n.key1.val)</span>
-00100 <span class="preprocessor"></span><span class="preprocessor">#define key2int(ptr) (ptr->n.key2.val)</span>
-00101 <span class="preprocessor"></span>
-00102 <span class="preprocessor">#define _stp_map_key2(map, key1, key2) \</span>
-00103 <span class="preprocessor"> ({ \</span>
-00104 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key1), char[])) \</span>
-00105 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span>
-00106 <span class="preprocessor"> _stp_map_key_str_str (map, (char *)(key1), (char *)(key2)); \</span>
-00107 <span class="preprocessor"> else \</span>
-00108 <span class="preprocessor"> _stp_map_key_str_long (map, (char *)(key1), (long)(key2)); \</span>
-00109 <span class="preprocessor"> else \</span>
-00110 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span>
-00111 <span class="preprocessor"> _stp_map_key_long_str (map, (long)(key1), (char *)(key2)); \</span>
-00112 <span class="preprocessor"> else \</span>
-00113 <span class="preprocessor"> _stp_map_key_long_long (map, (long)(key1), (long)(key2)); \</span>
-00114 <span class="preprocessor"> })</span>
-00115 <span class="preprocessor"></span>
-00116 <span class="preprocessor">#define _stp_map_key(map, key) \</span>
-00117 <span class="preprocessor"> ({ \</span>
-00118 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key), char[])) \</span>
-00119 <span class="preprocessor"> _stp_map_key_str (map, (char *)(key)); \</span>
-00120 <span class="preprocessor"> else \</span>
-00121 <span class="preprocessor"> _stp_map_key_long (map, (long)(key)); \</span>
-00122 <span class="preprocessor"> })</span>
-00123 <span class="preprocessor"></span>
-00124 <span class="preprocessor">#define _stp_map_set(map, val) \</span>
-00125 <span class="preprocessor"> ({ \</span>
-00126 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span>
-00127 <span class="preprocessor"> _stp_map_set_str (map, (char *)(val)); \</span>
-00128 <span class="preprocessor"> else \</span>
-00129 <span class="preprocessor"> _stp_map_set_int64 (map, (int64_t)(val)); \</span>
-00130 <span class="preprocessor"> })</span>
-00131 <span class="preprocessor"></span>
-00132 <span class="preprocessor">#define _stp_list_add(map, val) \</span>
-00133 <span class="preprocessor"> ({ \</span>
-00134 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span>
-00135 <span class="preprocessor"> _stp_list_add_str (map, (char *)(val)); \</span>
-00136 <span class="preprocessor"> else \</span>
-00137 <span class="preprocessor"> _stp_list_add_int64 (map, (int64_t)(val)); \</span>
-00138 <span class="preprocessor"> })</span>
-00139 <span class="preprocessor"></span>
-00140 <span class="comment"></span>
-00141 <span class="comment">/** Loop through all elements of a map.</span>
-00142 <span class="comment"> * @param map </span>
-00143 <span class="comment"> * @param ptr pointer to a map_node_stat, map_node_int64 or map_node_str</span>
-00144 <span class="comment"> *</span>
-00145 <span class="comment"> * @b Example:</span>
-00146 <span class="comment"> * @include foreach.c</span>
-00147 <span class="comment"> */</span>
-00148
-<a name="l00149"></a><a class="code" href="map_8h.html#a8">00149</a> <span class="preprocessor">#define foreach(map, ptr) \</span>
-00150 <span class="preprocessor"> for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \</span>
-00151 <span class="preprocessor"> ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))</span>
-00152 <span class="preprocessor"></span>
+00008 <span class="comment">/** Statistics are stored in this struct */</span>
+<a name="l00009"></a><a class="code" href="structstat.html">00009</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00010 int64_t count;
+00011 int64_t sum;
+00012 int64_t min, max;
+00013 int64_t histogram[BUCKETS];
+00014 } <a class="code" href="structstat.html">stat</a>;
+00015 <span class="comment"></span>
+00016 <span class="comment">/** Keys are either longs or char * */</span>
+<a name="l00017"></a><a class="code" href="unionkey__data.html">00017</a> <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> {
+00018 <span class="keywordtype">long</span> val;
+00019 <span class="keywordtype">char</span> *str;
+00020 };
+00021 <span class="comment"></span>
+00022 <span class="comment">/** keys can be longs or strings */</span>
+<a name="l00023"></a><a class="code" href="map_8h.html#a18">00023</a> <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> { NONE, LONG, STR } __attribute__ ((packed));<span class="comment"></span>
+00024 <span class="comment">/** values can be either int64, stats or strings */</span>
+<a name="l00025"></a><a class="code" href="map_8h.html#a19">00025</a> <span class="keyword">enum</span> <a class="code" href="map_8h.html#a19">valtype</a> { INT64, STAT, STRING, END };
+00026
+00027 <span class="comment"></span>
+00028 <span class="comment">/** basic map element */</span>
+<a name="l00029"></a><a class="code" href="structmap__node.html">00029</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> {<span class="comment"></span>
+00030 <span class="comment"> /** list of other nodes in the map */</span>
+<a name="l00031"></a><a class="code" href="structmap__node.html#o0">00031</a> <span class="keyword">struct </span>list_head lnode;<span class="comment"></span>
+00032 <span class="comment"> /** list of nodes with the same hash value */</span>
+<a name="l00033"></a><a class="code" href="structmap__node.html#o1">00033</a> <span class="keyword">struct </span>hlist_node hnode;
+00034 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key1;
+00035 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key2;
+00036 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> key1type;
+00037 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> key2type;
+00038 };
+00039 <span class="comment"></span>
+00040 <span class="comment">/** map element containing int64 */</span>
+<a name="l00041"></a><a class="code" href="structmap__node__int64.html">00041</a> <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> {
+00042 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n;
+00043 int64_t val;
+00044 };
+00045 <span class="comment"></span>
+00046 <span class="comment">/** map element containing string */</span>
+<a name="l00047"></a><a class="code" href="structmap__node__str.html">00047</a> <span class="keyword">struct </span><a class="code" href="structmap__node__str.html">map_node_str</a> {
+00048 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n;
+00049 <span class="keywordtype">char</span> *str;
+00050 };
+00051 <span class="comment"></span>
+00052 <span class="comment">/** map element containing stats */</span>
+<a name="l00053"></a><a class="code" href="structmap__node__stat.html">00053</a> <span class="keyword">struct </span><a class="code" href="structmap__node__stat.html">map_node_stat</a> {
+00054 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n;
+00055 <a class="code" href="structstat.html">stat</a> stats;
+00056 };
+00057 <span class="comment"></span>
+00058 <span class="comment">/** This structure contains all information about a map.</span>
+00059 <span class="comment"> * It is allocated once when _stp_map_new() is called. </span>
+00060 <span class="comment"> */</span>
+<a name="l00061"></a><a class="code" href="structmap__root.html">00061</a> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> {<span class="comment"></span>
+00062 <span class="comment"> /** type of the values stored in the array */</span>
+<a name="l00063"></a><a class="code" href="structmap__root.html#o0">00063</a> <span class="keyword">enum</span> <a class="code" href="map_8h.html#a19">valtype</a> <a class="code" href="structmap__root.html#o0">type</a>;
+00064 <span class="comment"></span>
+00065 <span class="comment"> /** maximum number of elements allowed in the array. */</span>
+<a name="l00066"></a><a class="code" href="structmap__root.html#o1">00066</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o1">maxnum</a>;
+00067 <span class="comment"></span>
+00068 <span class="comment"> /** current number of used elements */</span>
+<a name="l00069"></a><a class="code" href="structmap__root.html#o2">00069</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o2">num</a>;
+00070 <span class="comment"></span>
+00071 <span class="comment"> /** when more than maxnum elements, wrap or discard? */</span>
+<a name="l00072"></a><a class="code" href="structmap__root.html#o3">00072</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o3">no_wrap</a>;
+00073 <span class="comment"></span>
+00074 <span class="comment"> /** linked list of current entries */</span>
+<a name="l00075"></a><a class="code" href="structmap__root.html#o4">00075</a> <span class="keyword">struct </span>list_head head;
+00076 <span class="comment"></span>
+00077 <span class="comment"> /** pool of unused entries. Used only when entries are statically allocated</span>
+00078 <span class="comment"> at startup. */</span>
+<a name="l00079"></a><a class="code" href="structmap__root.html#o5">00079</a> <span class="keyword">struct </span>list_head pool;
+00080 <span class="comment"></span>
+00081 <span class="comment"> /** saved key entry for lookups */</span>
+<a name="l00082"></a><a class="code" href="structmap__root.html#o6">00082</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="structmap__root.html#o6">key</a>;
+00083 <span class="comment"></span>
+00084 <span class="comment"> /** this is the creation data saved between the key functions and the</span>
+00085 <span class="comment"> set/get functions </span>
+00086 <span class="comment"> @todo Needs to be per-cpu data for SMP support */</span>
+<a name="l00087"></a><a class="code" href="structmap__root.html#o7">00087</a> u_int8_t <a class="code" href="structmap__root.html#o7">create</a>;
+00088 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> c_key1type;
+00089 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> c_key2type;
+00090 <span class="keyword">struct </span>hlist_head *c_keyhead;
+00091 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key1;
+00092 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key2;
+00093 <span class="comment"></span>
+00094 <span class="comment"> /** the hash table for this array */</span>
+<a name="l00095"></a><a class="code" href="structmap__root.html#o13">00095</a> <span class="keyword">struct </span>hlist_head hashes[HASH_TABLE_SIZE];
+00096 <span class="comment"></span>
+00097 <span class="comment"> /** pointer to allocated memory space. Used for freeing memory. */</span>
+<a name="l00098"></a><a class="code" href="structmap__root.html#o14">00098</a> <span class="keywordtype">void</span> *<a class="code" href="structmap__root.html#o14">membuf</a>;
+00099 };
+00100 <span class="comment"></span>
+00101 <span class="comment">/** All maps are of this type. */</span>
+<a name="l00102"></a><a class="code" href="map_8h.html#a10">00102</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> *<a class="code" href="structmap__root.html">MAP</a>;
+00103 <span class="comment"></span>
+00104 <span class="comment">/** Extracts string from key1 union */</span>
+<a name="l00105"></a><a class="code" href="map_8h.html#a0">00105</a> <span class="preprocessor">#define key1str(ptr) (ptr->n.key1.str)</span>
+00106 <span class="preprocessor"></span><span class="comment">/** Extracts string from key2 union */</span>
+<a name="l00107"></a><a class="code" href="map_8h.html#a1">00107</a> <span class="preprocessor">#define key2str(ptr) (ptr->n.key2.str)</span>
+00108 <span class="preprocessor"></span><span class="comment">/** Extracts int from key1 union */</span>
+<a name="l00109"></a><a class="code" href="map_8h.html#a2">00109</a> <span class="preprocessor">#define key1int(ptr) (ptr->n.key1.val)</span>
+00110 <span class="preprocessor"></span><span class="comment">/** Extracts int from key2 union */</span>
+<a name="l00111"></a><a class="code" href="map_8h.html#a3">00111</a> <span class="preprocessor">#define key2int(ptr) (ptr->n.key2.val)</span>
+00112 <span class="preprocessor"></span><span class="comment"></span>
+00113 <span class="comment">/** Macro to call the proper _stp_map_key functions based on the</span>
+00114 <span class="comment"> * types of the arguments. </span>
+00115 <span class="comment"> * @note May cause compiler warning on some GCCs </span>
+00116 <span class="comment"> */</span>
+<a name="l00117"></a><a class="code" href="map_8h.html#a4">00117</a> <span class="preprocessor">#define _stp_map_key2(map, key1, key2) \</span>
+00118 <span class="preprocessor"> ({ \</span>
+00119 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key1), char[])) \</span>
+00120 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span>
+00121 <span class="preprocessor"> _stp_map_key_str_str (map, (char *)(key1), (char *)(key2)); \</span>
+00122 <span class="preprocessor"> else \</span>
+00123 <span class="preprocessor"> _stp_map_key_str_long (map, (char *)(key1), (long)(key2)); \</span>
+00124 <span class="preprocessor"> else \</span>
+00125 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span>
+00126 <span class="preprocessor"> _stp_map_key_long_str (map, (long)(key1), (char *)(key2)); \</span>
+00127 <span class="preprocessor"> else \</span>
+00128 <span class="preprocessor"> _stp_map_key_long_long (map, (long)(key1), (long)(key2)); \</span>
+00129 <span class="preprocessor"> })</span>
+00130 <span class="preprocessor"></span><span class="comment"></span>
+00131 <span class="comment">/** Macro to call the proper _stp_map_key function based on the</span>
+00132 <span class="comment"> * type of the argument. </span>
+00133 <span class="comment"> * @note May cause compiler warning on some GCCs </span>
+00134 <span class="comment"> */</span>
+<a name="l00135"></a><a class="code" href="map_8h.html#a5">00135</a> <span class="preprocessor">#define _stp_map_key(map, key) \</span>
+00136 <span class="preprocessor"> ({ \</span>
+00137 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key), char[])) \</span>
+00138 <span class="preprocessor"> _stp_map_key_str (map, (char *)(key)); \</span>
+00139 <span class="preprocessor"> else \</span>
+00140 <span class="preprocessor"> _stp_map_key_long (map, (long)(key)); \</span>
+00141 <span class="preprocessor"> })</span>
+00142 <span class="preprocessor"></span><span class="comment"></span>
+00143 <span class="comment">/** Macro to call the proper _stp_map_set function based on the</span>
+00144 <span class="comment"> * type of the argument. </span>
+00145 <span class="comment"> * @note May cause compiler warning on some GCCs </span>
+00146 <span class="comment"> */</span>
+<a name="l00147"></a><a class="code" href="map_8h.html#a6">00147</a> <span class="preprocessor">#define _stp_map_set(map, val) \</span>
+00148 <span class="preprocessor"> ({ \</span>
+00149 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span>
+00150 <span class="preprocessor"> _stp_map_set_str (map, (char *)(val)); \</span>
+00151 <span class="preprocessor"> else \</span>
+00152 <span class="preprocessor"> _stp_map_set_int64 (map, (int64_t)(val)); \</span>
+00153 <span class="preprocessor"> })</span>
+00154 <span class="preprocessor"></span><span class="comment"></span>
+00155 <span class="comment">/** Macro to call the proper _stp_list_add function based on the</span>
+00156 <span class="comment"> * types of the argument. </span>
+00157 <span class="comment"> * @note May cause compiler warning on some GCCs </span>
+00158 <span class="comment"> */</span>
+<a name="l00159"></a><a class="code" href="map_8h.html#a7">00159</a> <span class="preprocessor">#define _stp_list_add(map, val) \</span>
+00160 <span class="preprocessor"> ({ \</span>
+00161 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span>
+00162 <span class="preprocessor"> _stp_list_add_str (map, (char *)(val)); \</span>
+00163 <span class="preprocessor"> else \</span>
+00164 <span class="preprocessor"> _stp_list_add_int64 (map, (int64_t)(val)); \</span>
+00165 <span class="preprocessor"> })</span>
+00166 <span class="preprocessor"></span>
+00167 <span class="comment"></span>
+00168 <span class="comment">/** Loop through all elements of a map.</span>
+00169 <span class="comment"> * @param map </span>
+00170 <span class="comment"> * @param ptr pointer to a map_node_stat, map_node_int64 or map_node_str</span>
+00171 <span class="comment"> *</span>
+00172 <span class="comment"> * @b Example:</span>
+00173 <span class="comment"> * @include foreach.c</span>
+00174 <span class="comment"> */</span>
+00175
+<a name="l00176"></a><a class="code" href="map_8h.html#a8">00176</a> <span class="preprocessor">#define foreach(map, ptr) \</span>
+00177 <span class="preprocessor"> for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \</span>
+00178 <span class="preprocessor"> ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))</span>
+00179 <span class="preprocessor"></span>
</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>
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0" doxytag="map.h::key1str"></a>
-#define </td><td class="memItemRight" valign="bottom"><b>key1str</b>(ptr) (ptr->n.key1.str)</td></tr>
+#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a0">key1str</a>(ptr) (ptr->n.key1.str)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Extracts string from key1 union. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a1" doxytag="map.h::key2str"></a>
-#define </td><td class="memItemRight" valign="bottom"><b>key2str</b>(ptr) (ptr->n.key2.str)</td></tr>
+#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a1">key2str</a>(ptr) (ptr->n.key2.str)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Extracts string from key2 union. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2" doxytag="map.h::key1int"></a>
-#define </td><td class="memItemRight" valign="bottom"><b>key1int</b>(ptr) (ptr->n.key1.val)</td></tr>
+#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a2">key1int</a>(ptr) (ptr->n.key1.val)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Extracts int from key1 union. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a3" doxytag="map.h::key2int"></a>
-#define </td><td class="memItemRight" valign="bottom"><b>key2int</b>(ptr) (ptr->n.key2.val)</td></tr>
+#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a3">key2int</a>(ptr) (ptr->n.key2.val)</td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><b>_stp_map_key2</b>(map, key1, key2)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Extracts int from key2 union. <br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a4">_stp_map_key2</a>(map, key1, key2)</td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><b>_stp_map_key</b>(map, key)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Macro to call the proper _stp_map_key functions based on the types of the arguments. <a href="#a4"></a><br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a5">_stp_map_key</a>(map, key)</td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><b>_stp_map_set</b>(map, val)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Macro to call the proper _stp_map_key function based on the type of the argument. <a href="#a5"></a><br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a6">_stp_map_set</a>(map, val)</td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><b>_stp_list_add</b>(map, val)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Macro to call the proper _stp_map_set function based on the type of the argument. <a href="#a6"></a><br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a7">_stp_list_add</a>(map, val)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Macro to call the proper _stp_list_add function based on the types of the argument. <a href="#a7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a8">foreach</a>(map, ptr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Loop through all elements of a map. <a href="#a8"></a><br></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">All maps are of this type. <br></td></tr>
<tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b>keytype</b> { <b>NONE</b>,
+<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a18">keytype</a> { <b>NONE</b>,
<b>LONG</b>,
<b>STR</b>
}</td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b>valtype</b> { <b>INT64</b>,
+<tr><td class="mdescLeft"> </td><td class="mdescRight">keys can be longs or strings <br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a19">valtype</a> { <b>INT64</b>,
<b>STAT</b>,
<b>STRING</b>,
<b>END</b>
}</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">values can be either int64, stats or strings <br></td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a9" doxytag="map.h::packed"></a>
-enum keytype </td><td class="memItemRight" valign="bottom"><b>packed</b></td></tr>
+enum <a class="el" href="map_8h.html#a18">keytype</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="map_8h.html#a9">packed</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">keys can be longs or strings <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Header file for maps and lists.
<span class="keywordflow">else</span> \
<a class="code" href="map_8c.html#a28">_stp_list_add_int64</a> (map, (int64_t)(val)); \
})
-</pre></div>
+</pre></div>Macro to call the proper _stp_list_add function based on the types of the argument.
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00132">132</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
+<dl compact><dt><b>Note:</b></dt><dd>May cause compiler warning on some GCCs </dd></dl>
+
+<p>
+Definition at line <a class="el" href="map_8h-source.html#l00159">159</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
</tr>
</table>
<a class="anchor" name="a5" doxytag="map.h::_stp_map_key"></a><p>
<span class="keywordflow">else</span> \
<a class="code" href="map_8c.html#a14">_stp_map_key_long</a> (map, (<span class="keywordtype">long</span>)(key)); \
})
-</pre></div>
+</pre></div>Macro to call the proper _stp_map_key function based on the type of the argument.
+<p>
+<dl compact><dt><b>Note:</b></dt><dd>May cause compiler warning on some GCCs </dd></dl>
+
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00116">116</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
+Definition at line <a class="el" href="map_8h-source.html#l00135">135</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="map.h::_stp_map_key2"></a><p>
<span class="keywordflow">else</span> \
<a class="code" href="map_8c.html#a9">_stp_map_key_long_long</a> (map, (<span class="keywordtype">long</span>)(key1), (<span class="keywordtype">long</span>)(key2)); \
})
-</pre></div>
+</pre></div>Macro to call the proper _stp_map_key functions based on the types of the arguments.
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00102">102</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
+<dl compact><dt><b>Note:</b></dt><dd>May cause compiler warning on some GCCs </dd></dl>
+
+<p>
+Definition at line <a class="el" href="map_8h-source.html#l00117">117</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="map.h::_stp_map_set"></a><p>
<span class="keywordflow">else</span> \
<a class="code" href="map_8c.html#a17">_stp_map_set_int64</a> (map, (int64_t)(val)); \
})
-</pre></div>
+</pre></div>Macro to call the proper _stp_map_set function based on the type of the argument.
+<p>
+<dl compact><dt><b>Note:</b></dt><dd>May cause compiler warning on some GCCs </dd></dl>
+
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00124">124</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
+Definition at line <a class="el" href="map_8h-source.html#l00147">147</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
</tr>
</table>
<a class="anchor" name="a8" doxytag="map.h::foreach"></a><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>map</em> </td><td></td></tr>
- <tr><td valign="top"></td><td valign="top"><em>ptr</em> </td><td>pointer to a map_node_stat, map_node_int64 or map_node_str</td></tr>
+ <tr><td valign="top"></td><td valign="top"><em>ptr</em> </td><td>pointer to a <a class="el" href="structmap__node__stat.html">map_node_stat</a>, <a class="el" href="structmap__node__int64.html">map_node_int64</a> or <a class="el" href="structmap__node__str.html">map_node_str</a></td></tr>
</table>
</dl>
<b>Example:</b> <div class="fragment"><pre class="fragment"><span class="comment">/* example showing how to print all the stats in a map using foreach() */</span>
-<span class="keyword">struct </span>map_node_stat *ptr;
+<span class="keyword">struct </span><a class="code" href="structmap__node__stat.html">map_node_stat</a> *ptr;
<a class="code" href="map_8h.html#a8">foreach</a> (map, ptr)
printf ("map[%s,%ld] = [c=%lld s=%lld min=%lld max=%lld]\n", key1str(ptr),
</pre></div>
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00149">149</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
+Definition at line <a class="el" href="map_8h-source.html#l00176">176</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
</tr>
</table>
<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>
<h1>SystemTap Related Pages</h1>Here is a list of all related documentation pages:<ul>
<li><a class="el" href="todo.html">Todo List</a>
+<li><a class="el" href="bug.html">Bug List</a>
+
</ul>
<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>
00003 <span class="comment">the runtime library. They are tested on i386 and x86_64.</span>
00004 <span class="comment">*/</span>
</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>
00025 <span class="keywordflow">if</span> (!strcmp(current->comm,<span class="stringliteral">"bash"</span>) || !strcmp(current->comm,<span class="stringliteral">"sh"</span>) || !strcmp(current->comm, <span class="stringliteral">"zsh"</span>)
00026 || !strcmp(current->comm, <span class="stringliteral">"tcsh"</span>) || !strcmp(current->comm, <span class="stringliteral">"pdksh"</span>))
00027 {
-00028 dlog (<span class="stringliteral">"%d\t%d\t%d\t%s "</span>, current->uid, current->pid, current->parent->pid, filename);
+00028 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"%d\t%d\t%d\t%s "</span>, current->uid, current->pid, current->parent->pid, filename);
00029 @pids[current->pid] = 1;
00030
00031 <span class="comment">/* print out argv, ignoring argv[0] */</span>
00065 else len = 64;
00066 if (len = dtr_strncpy_from_user(str, buf, len)) {
00067 str[len] = 0;
-00068 dlog (<span class="stringliteral">"%d\t%d\t%s\tW %s\n"</span>, current->pid, current->parent->pid, current->comm, str);
+00068 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"%d\t%d\t%s\tW %s\n"</span>, current->pid, current->parent->pid, current->comm, str);
00069 }
00070 }
00071 }
00072 \endverbatim
00073 */
</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>
00009 <span class="comment"></span>
00010 <span class="comment">*/</span>
</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>
00023 <span class="comment">\endverbatim</span>
00024 <span class="comment">*/</span>
</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>
00025 <span class="comment">-Will Cohen</span>
00026 <span class="comment">*/</span>
</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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<h1>probes.c</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/* -*- linux-c -*- */</span>
-00002 <span class="comment"></span>
-00003 <span class="comment">/** Create a new map.</span>
-00004 <span class="comment"> * Maps must be created at module initialization time.</span>
-00005 <span class="comment"> * @param max_entries The maximum number of entries allowed. Currently that </span>
-00006 <span class="comment"> * will be allocated dynamically.</span>
-00007 <span class="comment"> * @param type Type of values stored in this map. </span>
-00008 <span class="comment"> * @return A MAP on success or NULL on failure.</span>
-00009 <span class="comment"> */</span>
-00010
-00011
-00012 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> long (*_stp_lookup_name)(<span class="keywordtype">char</span> *name)=(<span class="keywordtype">void</span> *)KALLSYMS_LOOKUP_NAME;
-00013
-00014 <span class="keywordtype">void</span> _stp_unregister_jprobes (<span class="keyword">struct</span> jprobe *probes, <span class="keywordtype">int</span> num_probes)
-00015 {
-00016 <span class="keywordtype">int</span> i;
-00017 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++)
-00018 unregister_jprobe(&probes[i]);
-00019 dlog ("All jprobes removed\n");
-00020 }
-00021
-00022 <span class="keywordtype">int</span> _stp_register_jprobes (struct jprobe *probes, <span class="keywordtype">int</span> num_probes)
-00023 {
-00024 <span class="keywordtype">int</span> i, ret ;
-00025 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
-00026
-00027 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++) {
-00028 addr =_stp_lookup_name((<span class="keywordtype">char</span> *)probes[i].kp.addr);
-00029 <span class="keywordflow">if</span> (addr == 0) {
-00030 dlog (<span class="stringliteral">"ERROR: function %s not found!\n"</span>,
-00031 (<span class="keywordtype">char</span> *)probes[i].kp.addr);
-00032 ret = -1; <span class="comment">/* FIXME */</span>
-00033 <span class="keywordflow">goto</span> out;
-00034 }
-00035 dlog(<span class="stringliteral">"inserting jprobe at %s (%p)\n"</span>, probes[i].kp.addr, addr);
-00036 probes[i].kp.addr = (kprobe_opcode_t *)addr;
-00037 ret = register_jprobe(&probes[i]);
-00038 <span class="keywordflow">if</span> (ret)
-00039 goto out;
-00040 }
-00041 return 0;
-00042 out:
-00043 dlog ("probe module initialization failed. Exiting...\n");
-00044 _stp_unregister_jprobes(probes, i);
-00045 return ret;
-00046 }
-00047
-00048 <span class="keywordtype">void</span> _stp_unregister_kprobes (struct kprobe *probes, <span class="keywordtype">int</span> num_probes)
-00049 {
-00050 <span class="keywordtype">int</span> i;
-00051 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++)
-00052 unregister_kprobe(&probes[i]);
-00053 dlog ("All kprobes removed\n");
-00054 }
-00055
-00056 <span class="keywordtype">int</span> _stp_register_kprobes (struct kprobe *probes, <span class="keywordtype">int</span> num_probes)
-00057 {
-00058 <span class="keywordtype">int</span> i, ret ;
-00059 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
-00060
-00061 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++) {
-00062 addr =_stp_lookup_name((<span class="keywordtype">char</span> *)probes[i].addr);
-00063 <span class="keywordflow">if</span> (addr == 0) {
-00064 dlog (<span class="stringliteral">"ERROR: function %s not found!\n"</span>,
-00065 (<span class="keywordtype">char</span> *)probes[i].addr);
-00066 ret = -1; <span class="comment">/* FIXME */</span>
-00067 <span class="keywordflow">goto</span> out;
-00068 }
-00069 dlog(<span class="stringliteral">"inserting kprobe at %s (%p)\n"</span>, probes[i].addr, addr);
-00070 probes[i].addr = (kprobe_opcode_t *)addr;
-00071 ret = register_kprobe(&probes[i]);
-00072 <span class="keywordflow">if</span> (ret)
-00073 goto out;
-00074 }
-00075 return 0;
-00076 out:
-00077 dlog ("probe module initialization failed. Exiting...\n");
-00078 _stp_unregister_kprobes(probes, i);
-00079 return ret;
-00080 }
+<h1>probes.c</h1><a href="probes_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 probes.c</span>
+00003 <span class="comment"> * @brief Functions to assist loading and unloading groups of probes.</span>
+00004 <span class="comment"> */</span>
+00005 <span class="comment"></span>
+00006 <span class="comment">/** Lookup name.</span>
+00007 <span class="comment"> * This simply calls the kernel function kallsyms_lookup_name().</span>
+00008 <span class="comment"> * That function is not exported, so this workaround is required.</span>
+00009 <span class="comment"> * See the kernel source, kernel/kallsyms.c for more information.</span>
+00010 <span class="comment"> */</span>
+<a name="l00011"></a><a class="code" href="probes_8c.html#a0">00011</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> long (*_stp_lookup_name)(<span class="keywordtype">char</span> *name)=(<span class="keywordtype">void</span> *)KALLSYMS_LOOKUP_NAME;
+00012 <span class="comment"></span>
+00013 <span class="comment">/** Unregister a group of jprobes.</span>
+00014 <span class="comment"> * @param probes Pointer to an array of struct jprobe.</span>
+00015 <span class="comment"> * @param num_probes Number of probes in the array.</span>
+00016 <span class="comment"> */</span>
+00017
+<a name="l00018"></a><a class="code" href="probes_8c.html#a1">00018</a> <span class="keywordtype">void</span> <a class="code" href="probes_8c.html#a1">_stp_unregister_jprobes</a> (<span class="keyword">struct</span> jprobe *probes, <span class="keywordtype">int</span> num_probes)
+00019 {
+00020 <span class="keywordtype">int</span> i;
+00021 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++)
+00022 unregister_jprobe(&probes[i]);
+00023 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"All jprobes removed\n"</span>);
+00024 }
+00025 <span class="comment"></span>
+00026 <span class="comment">/** Register a group of jprobes.</span>
+00027 <span class="comment"> * @param probes Pointer to an array of struct jprobe.</span>
+00028 <span class="comment"> * @param num_probes Number of probes in the array.</span>
+00029 <span class="comment"> * @return 0 on success.</span>
+00030 <span class="comment"> */</span>
+00031
+<a name="l00032"></a><a class="code" href="probes_8c.html#a2">00032</a> <span class="keywordtype">int</span> <a class="code" href="probes_8c.html#a2">_stp_register_jprobes</a> (<span class="keyword">struct</span> jprobe *probes, <span class="keywordtype">int</span> num_probes)
+00033 {
+00034 <span class="keywordtype">int</span> i, ret ;
+00035 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
+00036
+00037 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++) {
+00038 addr =<a class="code" href="probes_8c.html#a0">_stp_lookup_name</a>((<span class="keywordtype">char</span> *)probes[i].kp.addr);
+00039 <span class="keywordflow">if</span> (addr == 0) {
+00040 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"ERROR: function %s not found!\n"</span>,
+00041 (<span class="keywordtype">char</span> *)probes[i].kp.addr);
+00042 ret = -1; <span class="comment">/* FIXME */</span>
+00043 <span class="keywordflow">goto</span> out;
+00044 }
+00045 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"inserting jprobe at %s (%p)\n"</span>, probes[i].kp.addr, addr);
+00046 probes[i].kp.addr = (kprobe_opcode_t *)addr;
+00047 ret = register_jprobe(&probes[i]);
+00048 <span class="keywordflow">if</span> (ret)
+00049 <span class="keywordflow">goto</span> out;
+00050 }
+00051 <span class="keywordflow">return</span> 0;
+00052 out:
+00053 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"probe module initialization failed. Exiting...\n"</span>);
+00054 <a class="code" href="probes_8c.html#a1">_stp_unregister_jprobes</a>(probes, i);
+00055 <span class="keywordflow">return</span> ret;
+00056 }
+00057 <span class="comment"></span>
+00058 <span class="comment">/** Unregister a group of kprobes.</span>
+00059 <span class="comment"> * @param probes Pointer to an array of struct kprobe.</span>
+00060 <span class="comment"> * @param num_probes Number of probes in the array.</span>
+00061 <span class="comment"> */</span>
+00062
+<a name="l00063"></a><a class="code" href="probes_8c.html#a3">00063</a> <span class="keywordtype">void</span> <a class="code" href="probes_8c.html#a3">_stp_unregister_kprobes</a> (<span class="keyword">struct</span> kprobe *probes, <span class="keywordtype">int</span> num_probes)
+00064 {
+00065 <span class="keywordtype">int</span> i;
+00066 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++)
+00067 unregister_kprobe(&probes[i]);
+00068 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"All kprobes removed\n"</span>);
+00069 }
+00070 <span class="comment"></span>
+00071 <span class="comment">/** Register a group of kprobes.</span>
+00072 <span class="comment"> * @param probes Pointer to an array of struct kprobe.</span>
+00073 <span class="comment"> * @param num_probes Number of probes in the array.</span>
+00074 <span class="comment"> * @return 0 on success.</span>
+00075 <span class="comment"> */</span>
+00076
+<a name="l00077"></a><a class="code" href="probes_8c.html#a4">00077</a> <span class="keywordtype">int</span> <a class="code" href="probes_8c.html#a4">_stp_register_kprobes</a> (<span class="keyword">struct</span> kprobe *probes, <span class="keywordtype">int</span> num_probes)
+00078 {
+00079 <span class="keywordtype">int</span> i, ret ;
+00080 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
00081
+00082 <span class="keywordflow">for</span> (i = 0; i < num_probes; i++) {
+00083 addr =<a class="code" href="probes_8c.html#a0">_stp_lookup_name</a>((<span class="keywordtype">char</span> *)probes[i].addr);
+00084 <span class="keywordflow">if</span> (addr == 0) {
+00085 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"ERROR: function %s not found!\n"</span>,
+00086 (<span class="keywordtype">char</span> *)probes[i].addr);
+00087 ret = -1; <span class="comment">/* FIXME */</span>
+00088 <span class="keywordflow">goto</span> out;
+00089 }
+00090 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"inserting kprobe at %s (%p)\n"</span>, probes[i].addr, addr);
+00091 probes[i].addr = (kprobe_opcode_t *)addr;
+00092 ret = register_kprobe(&probes[i]);
+00093 <span class="keywordflow">if</span> (ret)
+00094 <span class="keywordflow">goto</span> out;
+00095 }
+00096 <span class="keywordflow">return</span> 0;
+00097 out:
+00098 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"probe module initialization failed. Exiting...\n"</span>);
+00099 <a class="code" href="probes_8c.html#a3">_stp_unregister_kprobes</a>(probes, i);
+00100 <span class="keywordflow">return</span> ret;
+00101 }
+00102
</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>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: probes.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<h1>probes.c File Reference</h1>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<h1>probes.c File Reference</h1>Functions to assist loading and unloading groups of probes. <a href="#_details">More...</a>
+<p>
+
<p>
<a href="probes_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="probes_8c.html#a1">_stp_unregister_jprobes</a> (struct jprobe *probes, int num_probes)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Unregister a group of jprobes. <a href="#a1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="probes_8c.html#a2">_stp_register_jprobes</a> (struct jprobe *probes, int num_probes)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Register a group of jprobes. <a href="#a2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="probes_8c.html#a3">_stp_unregister_kprobes</a> (struct kprobe *probes, int num_probes)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Unregister a group of kprobes. <a href="#a3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="probes_8c.html#a4">_stp_register_kprobes</a> (struct kprobe *probes, int num_probes)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Register a group of kprobes. <a href="#a4"></a><br></td></tr>
+<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">static unsigned long(* </td><td class="memItemRight" valign="bottom"><a class="el" href="probes_8c.html#a0">_stp_lookup_name</a> )(char *name) = (void *)KALLSYMS_LOOKUP_NAME</td></tr>
+
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Lookup name. <a href="#a0"></a><br></td></tr>
</table>
-<hr><h2>Function Documentation</h2>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Functions to assist loading and unloading groups of probes.
+<p>
+
+<p>
+Definition in file <a class="el" href="probes_8c-source.html">probes.c</a>.<hr><h2>Function Documentation</h2>
<a class="anchor" name="a2" doxytag="probes.c::_stp_register_jprobes"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td>
<p>
+Register a group of jprobes.
+<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign="top"></td><td valign="top"><em>probes</em> </td><td>Pointer to an array of struct jprobe. </td></tr>
+ <tr><td valign="top"></td><td valign="top"><em>num_probes</em> </td><td>Number of probes in the array. </td></tr>
+ </table>
+</dl>
+<dl compact><dt><b>Returns:</b></dt><dd>0 on success. </dd></dl>
<p>
-Definition at line <a class="el" href="probes_8c-source.html#l00022">22</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
+Definition at line <a class="el" href="probes_8c-source.html#l00032">32</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
<p>
-References <a class="el" href="probes_8c-source.html#l00014">_stp_unregister_jprobes()</a>, and <a class="el" href="io_8c-source.html#l00011">dlog()</a>. </td>
+References <a class="el" href="probes_8c-source.html#l00011">_stp_lookup_name</a>, <a class="el" href="probes_8c-source.html#l00018">_stp_unregister_jprobes()</a>, and <a class="el" href="io_8c-source.html#l00016">dlog()</a>. </td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="probes.c::_stp_register_kprobes"></a><p>
<td>
<p>
+Register a group of kprobes.
+<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign="top"></td><td valign="top"><em>probes</em> </td><td>Pointer to an array of struct kprobe. </td></tr>
+ <tr><td valign="top"></td><td valign="top"><em>num_probes</em> </td><td>Number of probes in the array. </td></tr>
+ </table>
+</dl>
+<dl compact><dt><b>Returns:</b></dt><dd>0 on success. </dd></dl>
<p>
-Definition at line <a class="el" href="probes_8c-source.html#l00056">56</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
+Definition at line <a class="el" href="probes_8c-source.html#l00077">77</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
<p>
-References <a class="el" href="probes_8c-source.html#l00048">_stp_unregister_kprobes()</a>, and <a class="el" href="io_8c-source.html#l00011">dlog()</a>. </td>
+References <a class="el" href="probes_8c-source.html#l00011">_stp_lookup_name</a>, <a class="el" href="probes_8c-source.html#l00063">_stp_unregister_kprobes()</a>, and <a class="el" href="io_8c-source.html#l00016">dlog()</a>. </td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="probes.c::_stp_unregister_jprobes"></a><p>
<td>
<p>
+Unregister a group of jprobes.
+<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign="top"></td><td valign="top"><em>probes</em> </td><td>Pointer to an array of struct jprobe. </td></tr>
+ <tr><td valign="top"></td><td valign="top"><em>num_probes</em> </td><td>Number of probes in the array. </td></tr>
+ </table>
+</dl>
<p>
-Definition at line <a class="el" href="probes_8c-source.html#l00014">14</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
+Definition at line <a class="el" href="probes_8c-source.html#l00018">18</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
<p>
-References <a class="el" href="io_8c-source.html#l00011">dlog()</a>.
+References <a class="el" href="io_8c-source.html#l00016">dlog()</a>.
<p>
-Referenced by <a class="el" href="probes_8c-source.html#l00022">_stp_register_jprobes()</a>. </td>
+Referenced by <a class="el" href="probes_8c-source.html#l00032">_stp_register_jprobes()</a>. </td>
</tr>
</table>
<a class="anchor" name="a3" doxytag="probes.c::_stp_unregister_kprobes"></a><p>
<td>
<p>
+Unregister a group of kprobes.
+<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign="top"></td><td valign="top"><em>probes</em> </td><td>Pointer to an array of struct kprobe. </td></tr>
+ <tr><td valign="top"></td><td valign="top"><em>num_probes</em> </td><td>Number of probes in the array. </td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="probes_8c-source.html#l00063">63</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
+<p>
+References <a class="el" href="io_8c-source.html#l00016">dlog()</a>.
+<p>
+Referenced by <a class="el" href="probes_8c-source.html#l00077">_stp_register_kprobes()</a>. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a0" doxytag="probes.c::_stp_lookup_name"></a><p>
+<table class="mdTable" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top">unsigned long(* <a class="el" href="probes_8c.html#a0">_stp_lookup_name</a>)(char *name) = (void *)KALLSYMS_LOOKUP_NAME<code> [static]</code> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing="5" cellpadding="0" border="0">
+ <tr>
+ <td>
+
+ </td>
+ <td>
<p>
-Definition at line <a class="el" href="probes_8c-source.html#l00048">48</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
+Lookup name.
+<p>
+This simply calls the kernel function kallsyms_lookup_name(). That function is not exported, so this workaround is required. See the kernel source, kernel/kallsyms.c for more information.
<p>
-References <a class="el" href="io_8c-source.html#l00011">dlog()</a>.
+Definition at line <a class="el" href="probes_8c-source.html#l00011">11</a> of file <a class="el" href="probes_8c-source.html">probes.c</a>.
<p>
-Referenced by <a class="el" href="probes_8c-source.html#l00056">_stp_register_kprobes()</a>. </td>
+Referenced by <a class="el" href="probes_8c-source.html#l00032">_stp_register_jprobes()</a>, and <a class="el" href="probes_8c-source.html#l00077">_stp_register_kprobes()</a>. </td>
</tr>
</table>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
00014 <span class="preprocessor">#include <asm/uaccess.h></span>
00015 <span class="preprocessor">#include <linux/kallsyms.h></span>
00016
-00017 <span class="preprocessor">#include "alloc.h"</span>
+00017 <span class="preprocessor">#include "<a class="code" href="alloc_8h.html">alloc.h</a>"</span>
00018 <span class="preprocessor">#include "<a class="code" href="map_8h.html">map.h</a>"</span>
00019
00020 <span class="preprocessor">#define dbug(args...) ;</span>
00021 <span class="preprocessor"></span>
</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>
00003 <span class="preprocessor"></span><span class="preprocessor">#define BUCKETS 16 </span><span class="comment">/* largest histogram width */</span>
00004
00005 <span class="preprocessor">#include "runtime.h"</span>
-00006 <span class="preprocessor">#include "io.c"</span>
+00006 <span class="preprocessor">#include "<a class="code" href="io_8c.html">io.c</a>"</span>
00007 <span class="preprocessor">#include "<a class="code" href="map_8c.html">map.c</a>"</span>
-00008 <span class="preprocessor">#include "copy.c"</span>
-00009 <span class="preprocessor">#include "probes.c"</span>
+00008 <span class="preprocessor">#include "<a class="code" href="copy_8c.html">copy.c</a>"</span>
+00009 <span class="preprocessor">#include "<a class="code" href="probes_8c.html">probes.c</a>"</span>
00010
00011 MODULE_DESCRIPTION(<span class="stringliteral">"SystemTap probe: shellsnoop"</span>);
00012 MODULE_AUTHOR(<span class="stringliteral">"Martin Hunt <hunt@redhat.com>"</span>);
00015
00016 <span class="keywordtype">int</span> inst_do_execve (<span class="keywordtype">char</span> * filename, <span class="keywordtype">char</span> __user *__user *argv, <span class="keywordtype">char</span> __user *__user *envp, <span class="keyword">struct</span> pt_regs * regs)
00017 {
-00018 <span class="keyword">struct </span>map_node_str *ptr;
+00018 <span class="keyword">struct </span><a class="code" href="structmap__node__str.html">map_node_str</a> *ptr;
00019
00020 <span class="comment">/* watch shells only */</span>
00021 <span class="comment">/* FIXME: detect more shells, like csh, tcsh, zsh */</span>
00023 <span class="keywordflow">if</span> (!strcmp(current->comm,<span class="stringliteral">"bash"</span>) || !strcmp(current->comm,<span class="stringliteral">"sh"</span>) || !strcmp(current->comm, <span class="stringliteral">"zsh"</span>)
00024 || !strcmp(current->comm, <span class="stringliteral">"tcsh"</span>) || !strcmp(current->comm, <span class="stringliteral">"pdksh"</span>))
00025 {
-00026 dlog (<span class="stringliteral">"%d\t%d\t%d\t%s "</span>, current->uid, current->pid, current->parent->pid, filename);
+00026 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"%d\t%d\t%d\t%s "</span>, current->uid, current->pid, current->parent->pid, filename);
00027
00028 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a> (pids, current->pid);
00029 <a class="code" href="map_8c.html#a17">_stp_map_set_int64</a> (pids, 1);
00030
00031 <a class="code" href="map_8c.html#a26">_stp_list_clear</a> (arglist);
-00032 _stp_copy_argv_from_user (arglist, argv);
+00032 <a class="code" href="copy_8c.html#a2">_stp_copy_argv_from_user</a> (arglist, argv);
00033 <a class="code" href="map_8h.html#a8">foreach</a> (arglist, ptr)
00034 printk ("%s ", ptr->str);
00035 printk ("\n");
00042 {
00043 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a> (pids, current->pid);
00044 <span class="keywordflow">if</span> (_stp_map_get_int64 (pids))
-00045 dlog (<span class="stringliteral">"%d\t%d\t%s\tO %s\n"</span>, current->pid, current->parent->pid, current->comm, filename);
+00045 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"%d\t%d\t%s\tO %s\n"</span>, current->pid, current->parent->pid, current->comm, filename);
00046
00047 jprobe_return();
00048 <span class="keywordflow">return</span> 0;
00052 {
00053 <a class="code" href="map_8c.html#a14">_stp_map_key_long</a> (pids, current->pid);
00054 <span class="keywordflow">if</span> (_stp_map_get_int64 (pids))
-00055 dlog (<span class="stringliteral">"%d\t%d\t%s\tR %d\n"</span>, current->pid, current->parent->pid, current->comm, fd);
+00055 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"%d\t%d\t%s\tR %d\n"</span>, current->pid, current->parent->pid, current->comm, fd);
00056
00057 jprobe_return();
00058 <span class="keywordflow">return</span> 0;
00107 pids = <a class="code" href="map_8c.html#a3">_stp_map_new</a> (10000, INT64);
00108 arglist = <a class="code" href="map_8c.html#a25">_stp_list_new</a> (10, STRING);
00109
-00110 ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+00110 ret = <a class="code" href="probes_8c.html#a2">_stp_register_jprobes</a> (dtr_probes, MAX_DTR_ROUTINE);
00111
-00112 dlog(<span class="stringliteral">"instrumentation is enabled...\n"</span>);
+00112 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"instrumentation is enabled...\n"</span>);
00113 <span class="keywordflow">return</span> ret;
00114 }
00115
00116 <span class="keyword">static</span> <span class="keywordtype">void</span> cleanup_dtr(<span class="keywordtype">void</span>)
00117 {
-00118 _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+00118 <a class="code" href="probes_8c.html#a1">_stp_unregister_jprobes</a> (dtr_probes, MAX_DTR_ROUTINE);
00119 <a class="code" href="map_8c.html#a8">_stp_map_del</a> (pids);
-00120 dlog(<span class="stringliteral">"EXIT\n"</span>);
+00120 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"EXIT\n"</span>);
00121 }
00122
00123 module_init(init_dtr);
00125 MODULE_LICENSE(<span class="stringliteral">"GPL"</span>);
00126
</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>
00012 <span class="keywordtype">char</span> *delim = <span class="stringliteral">":"</span>;
00013 <span class="keywordtype">char</span> namebuf[128];
00014
-00015 symname = _stp_kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
+00015 symname = <a class="code" href="io_8c.html#a1">_stp_kallsyms_lookup</a>(address, &symsize, &offset, &modname, namebuf);
00016 <span class="keywordflow">if</span> (!symname)
00017 return printk("[<%016lx>]", address);
00018 if (!modname)
00173 <span class="stringliteral">}</span>
00174 <span class="stringliteral">#endif</span>
</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>
00007 <span class="preprocessor"></span><span class="preprocessor">#define BUCKETS 16 </span><span class="comment">/* largest histogram width */</span>
00008
00009 <span class="preprocessor">#include "runtime.h"</span>
-00010 <span class="preprocessor">#include "io.c"</span>
-00011 <span class="preprocessor">#include "probes.c"</span>
+00010 <span class="preprocessor">#include "<a class="code" href="io_8c.html">io.c</a>"</span>
+00011 <span class="preprocessor">#include "<a class="code" href="probes_8c.html">probes.c</a>"</span>
00012
00013 MODULE_DESCRIPTION(<span class="stringliteral">"test jprobes of tasklets"</span>);
00014 MODULE_AUTHOR(<span class="stringliteral">"Martin Hunt <hunt@redhat.com>"</span>);
00016 <span class="keywordtype">void</span> inst__rcu_process_callbacks(<span class="keyword">struct</span> rcu_ctrlblk *rcp,
00017 <span class="keyword">struct</span> rcu_state *rsp, <span class="keyword">struct</span> rcu_data *rdp)
00018 {
-00019 dlog (<span class="stringliteral">"interrupt=%d\n"</span>, in_interrupt());
+00019 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"interrupt=%d\n"</span>, in_interrupt());
00020 jprobe_return();
00021 }
00022
00031
00032 <span class="keyword">static</span> <span class="keywordtype">int</span> init_stp(<span class="keywordtype">void</span>)
00033 {
-00034 <span class="keywordtype">int</span> ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES);
-00035 dlog(<span class="stringliteral">"instrumentation is enabled...\n"</span>);
+00034 <span class="keywordtype">int</span> ret = <a class="code" href="probes_8c.html#a2">_stp_register_jprobes</a> (stp_probes, MAX_STP_PROBES);
+00035 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"instrumentation is enabled...\n"</span>);
00036 <span class="keywordflow">return</span> ret;
00037 }
00038
00039 <span class="keyword">static</span> <span class="keywordtype">void</span> cleanup_stp(<span class="keywordtype">void</span>)
00040 {
-00041 _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES);
-00042 dlog (<span class="stringliteral">"EXIT\n"</span>);
+00041 <a class="code" href="probes_8c.html#a1">_stp_unregister_jprobes</a> (stp_probes, MAX_STP_PROBES);
+00042 <a class="code" href="io_8c.html#a4">dlog</a> (<span class="stringliteral">"EXIT\n"</span>);
00043 }
00044
00045 module_init(init_stp);
00047 MODULE_LICENSE(<span class="stringliteral">"GPL"</span>);
00048
</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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<h1>map_node Struct Reference</h1>all map nodes have the following structure
+<h1>map_node Struct Reference</h1>basic map element
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="map_8h-source.html">map.h</a>></code>
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o0" doxytag="map_node::lnode"></a>
-list_head </td><td class="memItemRight" valign="bottom"><b>lnode</b></td></tr>
+list_head </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node.html#o0">lnode</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">list of other nodes in the map <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o1" doxytag="map_node::hnode"></a>
-hlist_node </td><td class="memItemRight" valign="bottom"><b>hnode</b></td></tr>
+hlist_node </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node.html#o1">hnode</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">list of nodes with the same hash value <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o2" doxytag="map_node::key1"></a>
<a class="el" href="unionkey__data.html">key_data</a> </td><td class="memItemRight" valign="bottom"><b>key1</b></td></tr>
<a class="el" href="unionkey__data.html">key_data</a> </td><td class="memItemRight" valign="bottom"><b>key2</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o4" doxytag="map_node::key1type"></a>
-enum keytype </td><td class="memItemRight" valign="bottom"><b>key1type</b></td></tr>
+enum <a class="el" href="map_8h.html#a18">keytype</a> </td><td class="memItemRight" valign="bottom"><b>key1type</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o5" doxytag="map_node::key2type"></a>
-enum keytype </td><td class="memItemRight" valign="bottom"><b>key2type</b></td></tr>
+enum <a class="el" href="map_8h.html#a18">keytype</a> </td><td class="memItemRight" valign="bottom"><b>key2type</b></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
-all map nodes have the following structure
+basic map element
<p>
<p>
Definition at line <a class="el" href="map_8h-source.html#l00029">29</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="map_8h-source.html">map.h</a></ul>
<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>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: map_node_int64 Struct Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<h1>map_node_int64 Struct Reference</h1><code>#include <<a class="el" href="map_8h-source.html">map.h</a>></code>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<h1>map_node_int64 Struct Reference</h1>map element containing int64
+<a href="#_details">More...</a>
+<p>
+<code>#include <<a class="el" href="map_8h-source.html">map.h</a>></code>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structmap__node.html">map_node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node__int64.html#o0">n</a></td></tr>
-
-<tr><td class="memItemLeft" nowrap align="right" valign="top">int64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node__int64.html#o1">val</a></td></tr>
-
-</table>
-<hr><h2>Field Documentation</h2>
-<a class="anchor" name="o0" doxytag="map_node_int64::n"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">struct <a class="el" href="structmap__node.html">map_node</a> <a class="el" href="structmap__node__int64.html#o0">map_node_int64::n</a> </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o0" doxytag="map_node_int64::n"></a>
+<a class="el" href="structmap__node.html">map_node</a> </td><td class="memItemRight" valign="bottom"><b>n</b></td></tr>
-<p>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o1" doxytag="map_node_int64::val"></a>
+int64_t </td><td class="memItemRight" valign="bottom"><b>val</b></td></tr>
-<p>
-Definition at line <a class="el" href="map_8h-source.html#l00031">31</a> of file <a class="el" href="map_8h-source.html">map.h</a>. </td>
- </tr>
-</table>
-<a class="anchor" name="o1" doxytag="map_node_int64::val"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">int64_t <a class="el" href="structmap__node__int64.html#o1">map_node_int64::val</a> </td>
- </tr>
- </table>
- </td>
- </tr>
</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
-
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+map element containing int64
<p>
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00032">32</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
-<p>
-Referenced by <a class="el" href="map_8c-source.html#l00551">_stp_map_get_int64()</a>. </td>
- </tr>
-</table>
-<hr>The documentation for this struct was generated from the following file:<ul>
+Definition at line <a class="el" href="map_8h-source.html#l00041">41</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="map_8h-source.html">map.h</a></ul>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: map_node_stat Struct Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<h1>map_node_stat Struct Reference</h1><code>#include <<a class="el" href="map_8h-source.html">map.h</a>></code>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<h1>map_node_stat Struct Reference</h1>map element containing stats
+<a href="#_details">More...</a>
+<p>
+<code>#include <<a class="el" href="map_8h-source.html">map.h</a>></code>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structmap__node.html">map_node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node__stat.html#o0">n</a></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o0" doxytag="map_node_stat::n"></a>
+<a class="el" href="structmap__node.html">map_node</a> </td><td class="memItemRight" valign="bottom"><b>n</b></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structstat.html">stat</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node__stat.html#o1">stats</a></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o1" doxytag="map_node_stat::stats"></a>
+<a class="el" href="structstat.html">stat</a> </td><td class="memItemRight" valign="bottom"><b>stats</b></td></tr>
</table>
-<hr><h2>Field Documentation</h2>
-<a class="anchor" name="o0" doxytag="map_node_stat::n"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">struct <a class="el" href="structmap__node.html">map_node</a> <a class="el" href="structmap__node__stat.html#o0">map_node_stat::n</a> </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
-
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+map element containing stats
<p>
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00041">41</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
-<p>
-Referenced by <a class="el" href="map_8c-source.html#l00656">_stp_map_set_stat()</a>. </td>
- </tr>
-</table>
-<a class="anchor" name="o1" doxytag="map_node_stat::stats"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top"><a class="el" href="structstat.html">stat</a> <a class="el" href="structmap__node__stat.html#o1">map_node_stat::stats</a> </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
-
-<p>
-
-<p>
-Definition at line <a class="el" href="map_8h-source.html#l00042">42</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
-<p>
-Referenced by <a class="el" href="map_8c-source.html#l00715">_stp_map_get_stat()</a>, <a class="el" href="map_8c-source.html#l00656">_stp_map_set_stat()</a>, and <a class="el" href="map_8c-source.html#l00736">_stp_map_stat_add()</a>. </td>
- </tr>
-</table>
-<hr>The documentation for this struct was generated from the following file:<ul>
+Definition at line <a class="el" href="map_8h-source.html#l00053">53</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="map_8h-source.html">map.h</a></ul>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
<!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: SystemTap Runtime Library</title>
+<title>SystemTap: map_node_str Struct Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
-<div class="qindex"><a class="qindex" href="index.html">Intro</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_defs.html">Defines</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration Values</a></div>
-
<!-- Generated by Doxygen 1.4.1 -->
-<h1>map_node_str Struct Reference</h1><code>#include <<a class="el" href="map_8h-source.html">map.h</a>></code>
+<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
+<h1>map_node_str Struct Reference</h1>map element containing string
+<a href="#_details">More...</a>
+<p>
+<code>#include <<a class="el" href="map_8h-source.html">map.h</a>></code>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structmap__node.html">map_node</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node__str.html#o0">n</a></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o0" doxytag="map_node_str::n"></a>
+<a class="el" href="structmap__node.html">map_node</a> </td><td class="memItemRight" valign="bottom"><b>n</b></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__node__str.html#o1">str</a></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o1" doxytag="map_node_str::str"></a>
+char * </td><td class="memItemRight" valign="bottom"><b>str</b></td></tr>
</table>
-<hr><h2>Field Documentation</h2>
-<a class="anchor" name="o0" doxytag="map_node_str::n"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">struct <a class="el" href="structmap__node.html">map_node</a> <a class="el" href="structmap__node__str.html#o0">map_node_str::n</a> </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
-
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+map element containing string
<p>
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00036">36</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
-<p>
-Referenced by <a class="el" href="map_8c-source.html#l00571">_stp_map_set_str()</a>. </td>
- </tr>
-</table>
-<a class="anchor" name="o1" doxytag="map_node_str::str"></a><p>
-<table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">char* <a class="el" href="structmap__node__str.html#o1">map_node_str::str</a> </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
-
-<p>
-
-<p>
-Definition at line <a class="el" href="map_8h-source.html#l00037">37</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
-<p>
-Referenced by <a class="el" href="map_8c-source.html#l00632">_stp_map_get_str()</a>, and <a class="el" href="map_8c-source.html#l00571">_stp_map_set_str()</a>. </td>
- </tr>
-</table>
-<hr>The documentation for this struct was generated from the following file:<ul>
+Definition at line <a class="el" href="map_8h-source.html#l00047">47</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="map_8h-source.html">map.h</a></ul>
-<hr size="1"><address style="align: right;"><small>Generated on Mon Mar 21 13:29:45 2005 for SystemTap by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
-</body>
+<hr size="1"><address style="align: right;"><small>
+Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o0" doxytag="map_root::type"></a>
-enum valtype </td><td class="memItemRight" valign="bottom"><b>type</b></td></tr>
+enum <a class="el" href="map_8h.html#a19">valtype</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o0">type</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">type of the values stored in the array <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o1" doxytag="map_root::maxnum"></a>
int </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o1">maxnum</a></td></tr>
-<tr><td class="mdescLeft"> </td><td class="mdescRight">type of the values stored in the array <br></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">maximum number of elements allowed in the array. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o2" doxytag="map_root::num"></a>
int </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o2">num</a></td></tr>
-<tr><td class="mdescLeft"> </td><td class="mdescRight">maximum number of elements allowed in the array. <br></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">current number of used elements <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o3" doxytag="map_root::no_wrap"></a>
-int </td><td class="memItemRight" valign="bottom"><b>no_wrap</b></td></tr>
+int </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o3">no_wrap</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">when more than maxnum elements, wrap or discard? <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o4" doxytag="map_root::head"></a>
-list_head </td><td class="memItemRight" valign="bottom"><b>head</b></td></tr>
+list_head </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o4">head</a></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o5" doxytag="map_root::pool"></a>
-list_head </td><td class="memItemRight" valign="bottom"><b>pool</b></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">linked list of current entries <br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">list_head </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o5">pool</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">pool of unused entries. <a href="#o5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o6" doxytag="map_root::key"></a>
-<a class="el" href="structmap__node.html">map_node</a> * </td><td class="memItemRight" valign="bottom"><b>key</b></td></tr>
+<a class="el" href="structmap__node.html">map_node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o6">key</a></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o7" doxytag="map_root::create"></a>
-u_int8_t </td><td class="memItemRight" valign="bottom"><b>create</b></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">saved key entry for lookups <br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o7">create</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">this is the creation data saved between the key functions and the set/get functions <a href="#o7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o8" doxytag="map_root::c_key1type"></a>
-enum keytype </td><td class="memItemRight" valign="bottom"><b>c_key1type</b></td></tr>
+enum <a class="el" href="map_8h.html#a18">keytype</a> </td><td class="memItemRight" valign="bottom"><b>c_key1type</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o9" doxytag="map_root::c_key2type"></a>
-enum keytype </td><td class="memItemRight" valign="bottom"><b>c_key2type</b></td></tr>
+enum <a class="el" href="map_8h.html#a18">keytype</a> </td><td class="memItemRight" valign="bottom"><b>c_key2type</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o10" doxytag="map_root::c_keyhead"></a>
hlist_head * </td><td class="memItemRight" valign="bottom"><b>c_keyhead</b></td></tr>
<a class="el" href="unionkey__data.html">key_data</a> </td><td class="memItemRight" valign="bottom"><b>c_key2</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o13" doxytag="map_root::hashes"></a>
-hlist_head </td><td class="memItemRight" valign="bottom"><b>hashes</b> [HASH_TABLE_SIZE]</td></tr>
+hlist_head </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o13">hashes</a> [HASH_TABLE_SIZE]</td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="o14" doxytag="map_root::membuf"></a>
-void * </td><td class="memItemRight" valign="bottom"><b>membuf</b></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">the hash table for this array <br></td></tr>
+<tr><td class="memItemLeft" nowrap align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="structmap__root.html#o14">membuf</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">pointer to allocated memory space. <a href="#o14"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This structure contains all information about a map.
<p>
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00057">57</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this struct was generated from the following file:<ul>
+Definition at line <a class="el" href="map_8h-source.html#l00061">61</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o7" doxytag="map_root::create"></a><p>
+<table class="mdTable" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top">u_int8_t <a class="el" href="structmap__root.html#o7">map_root::create</a> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing="5" cellpadding="0" border="0">
+ <tr>
+ <td>
+
+ </td>
+ <td>
+
+<p>
+this is the creation data saved between the key functions and the set/get functions
+<p>
+<dl compact><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>Needs to be per-cpu data for SMP support</dd></dl>
+
+<p>
+Definition at line <a class="el" href="map_8h-source.html#l00087">87</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
+<p>
+Referenced by <a class="el" href="map_8c-source.html#l00557">_stp_map_get_int64()</a>, <a class="el" href="map_8c-source.html#l00721">_stp_map_get_stat()</a>, <a class="el" href="map_8c-source.html#l00638">_stp_map_get_str()</a>, <a class="el" href="map_8c-source.html#l00222">_stp_map_key_long_long()</a>, <a class="el" href="map_8c-source.html#l00362">_stp_map_key_long_str()</a>, <a class="el" href="map_8c-source.html#l00314">_stp_map_key_str_long()</a>, <a class="el" href="map_8c-source.html#l00265">_stp_map_key_str_str()</a>, <a class="el" href="map_8c-source.html#l00662">_stp_map_set_stat()</a>, <a class="el" href="map_8c-source.html#l00577">_stp_map_set_str()</a>, and <a class="el" href="map_8c-source.html#l00742">_stp_map_stat_add()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="o14" doxytag="map_root::membuf"></a><p>
+<table class="mdTable" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top">void* <a class="el" href="structmap__root.html#o14">map_root::membuf</a> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing="5" cellpadding="0" border="0">
+ <tr>
+ <td>
+
+ </td>
+ <td>
+
+<p>
+pointer to allocated memory space.
+<p>
+Used for freeing memory.
+<p>
+Definition at line <a class="el" href="map_8h-source.html#l00098">98</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
+<p>
+Referenced by <a class="el" href="map_8c-source.html#l00194">_stp_map_del()</a>, and <a class="el" href="map_8c-source.html#l00046">_stp_map_new()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="o5" doxytag="map_root::pool"></a><p>
+<table class="mdTable" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top">struct list_head <a class="el" href="structmap__root.html#o5">map_root::pool</a> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing="5" cellpadding="0" border="0">
+ <tr>
+ <td>
+
+ </td>
+ <td>
+
+<p>
+pool of unused entries.
+<p>
+Used only when entries are statically allocated at startup.
+<p>
+Definition at line <a class="el" href="map_8h-source.html#l00079">79</a> of file <a class="el" href="map_8h-source.html">map.h</a>.
+<p>
+Referenced by <a class="el" href="map_8c-source.html#l00794">_stp_list_clear()</a>, <a class="el" href="map_8c-source.html#l00046">_stp_map_new()</a>, <a class="el" href="map_8c-source.html#l00662">_stp_map_set_stat()</a>, and <a class="el" href="map_8c-source.html#l00577">_stp_map_set_str()</a>. </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="map_8h-source.html">map.h</a></ul>
<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>
<p>
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00010">10</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this struct was generated from the following file:<ul>
+Definition at line <a class="el" href="map_8h-source.html#l00009">9</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="map_8h-source.html">map.h</a></ul>
<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>
00003 <span class="preprocessor"></span><span class="preprocessor">#define BUCKETS 16 </span><span class="comment">/* largest histogram width */</span>
00004
00005 <span class="preprocessor">#include "runtime.h"</span>
-00006 <span class="preprocessor">#include "io.c"</span>
+00006 <span class="preprocessor">#include "<a class="code" href="io_8c.html">io.c</a>"</span>
00007 <span class="preprocessor">#include "<a class="code" href="map_8c.html">map.c</a>"</span>
-00008 <span class="preprocessor">#include "probes.c"</span>
+00008 <span class="preprocessor">#include "<a class="code" href="probes_8c.html">probes.c</a>"</span>
00009
00010 MODULE_DESCRIPTION(<span class="stringliteral">"SystemTap probe: test4"</span>);
00011 MODULE_AUTHOR(<span class="stringliteral">"Martin Hunt <hunt@redhat.com>"</span>);
00061 reads = <a class="code" href="map_8c.html#a3">_stp_map_new</a> (1000, STAT);
00062 writes = <a class="code" href="map_8c.html#a3">_stp_map_new</a> (1000, STAT);
00063
-00064 ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+00064 ret = <a class="code" href="probes_8c.html#a2">_stp_register_jprobes</a> (dtr_probes, MAX_DTR_ROUTINE);
00065
-00066 dlog(<span class="stringliteral">"instrumentation is enabled...\n"</span>);
+00066 <a class="code" href="io_8c.html#a4">dlog</a>(<span class="stringliteral">"instrumentation is enabled...\n"</span>);
00067 <span class="keywordflow">return</span> ret;
00068
00069 }
00070
00071 <span class="keyword">static</span> <span class="keywordtype">void</span> cleanup_dtr(<span class="keywordtype">void</span>)
00072 {
-00073 <span class="keyword">struct </span>map_node_stat *st;
-00074 <span class="keyword">struct </span>map_node_int64 *ptr;
+00073 <span class="keyword">struct </span><a class="code" href="structmap__node__stat.html">map_node_stat</a> *st;
+00074 <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> *ptr;
00075
-00076 _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+00076 <a class="code" href="probes_8c.html#a1">_stp_unregister_jprobes</a> (dtr_probes, MAX_DTR_ROUTINE);
00077
-00078 <span class="keywordflow">for</span> (ptr = (<span class="keyword">struct</span> map_node_int64 *)<a class="code" href="map_8c.html#a6">_stp_map_start</a>(opens); ptr;
-00079 ptr = (<span class="keyword">struct</span> map_node_int64 *)_stp_map_iter (opens,(<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)ptr))
+00078 <span class="keywordflow">for</span> (ptr = (<span class="keyword">struct</span> <a class="code" href="structmap__node__int64.html">map_node_int64</a> *)<a class="code" href="map_8c.html#a6">_stp_map_start</a>(opens); ptr;
+00079 ptr = (<span class="keyword">struct</span> <a class="code" href="structmap__node__int64.html">map_node_int64</a> *)_stp_map_iter (opens,(<span class="keyword">struct</span> <a class="code" href="structmap__node.html">map_node</a> *)ptr))
00080 dlog ("opens[%s] = %lld\n", key1str(ptr), ptr->val);
00081 dlog ("\n");
00082
-00083 for (st = (struct map_node_stat *)_stp_map_start(reads); st;
-00084 st = (struct map_node_stat *)_stp_map_iter (reads,(struct <a class="code" href="structmap__node.html">map_node</a> *)st))
+00083 for (st = (struct <a class="code" href="structmap__node__stat.html">map_node_stat</a> *)_stp_map_start(reads); st;
+00084 st = (struct <a class="code" href="structmap__node__stat.html">map_node_stat</a> *)_stp_map_iter (reads,(struct <a class="code" href="structmap__node.html">map_node</a> *)st))
00085 dlog ("reads[%s] = [count=%lld sum=%lld min=%lld max=%lld]\n", key1str(st), st->stats.count, st->stats.sum,
00086 st->stats.min, st->stats.max);
00087 dlog ("\n");
00088
-00089 for (st = (struct map_node_stat *)_stp_map_start(writes); st;
-00090 st = (struct map_node_stat *)_stp_map_iter (writes,(struct <a class="code" href="structmap__node.html">map_node</a> *)st))
+00089 for (st = (struct <a class="code" href="structmap__node__stat.html">map_node_stat</a> *)_stp_map_start(writes); st;
+00090 st = (struct <a class="code" href="structmap__node__stat.html">map_node_stat</a> *)_stp_map_iter (writes,(struct <a class="code" href="structmap__node.html">map_node</a> *)st))
00091 dlog ("writes[%s] = [count=%lld sum=%lld min=%lld max=%lld]\n", key1str(st), st->stats.count, st->stats.sum,
00092 st->stats.min, st->stats.max);
00093 dlog ("\n");
00104 MODULE_LICENSE("GPL");
00105
</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>
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
-<h1><a class="anchor" name="todo">Todo List</a></h1><a class="anchor" name="_todo000002"></a> <dl>
+<h1><a class="anchor" name="todo">Todo List</a></h1><a class="anchor" name="_todo000005"></a> <dl>
+<dt>Global <a class="el" href="structmap__root.html#o7">map_root::create</a> </dt>
+<dd>Needs to be per-cpu data for SMP support</dd>
+</dl>
+<p>
+<a class="anchor" name="_todo000001"></a> <dl>
+<dt>File <a class="el" href="alloc_8h.html">alloc.h</a> </dt>
+<dd>Should really be alloc.c for consistency. </dd>
+</dl>
+<p>
+<a class="anchor" name="_todo000002"></a> <dl>
+<dt>Global <a class="el" href="io_8c.html#a4">dlog</a> (const char *fmt,...) </dt>
+<dd>Needs replaced with something much faster that does not use the system log. </dd>
+</dl>
+<p>
+<a class="anchor" name="_todo000003"></a> <dl>
<dt>Global <a class="el" href="map_8c.html#a22">_stp_map_set_stat</a> (MAP map, stat *stats) </dt>
<dd>Histograms don't work yet. </dd>
</dl>
<p>
-<a class="anchor" name="_todo000003"></a> <dl>
+<a class="anchor" name="_todo000004"></a> <dl>
<dt>Global <a class="el" href="map_8c.html#a24">_stp_map_stat_add</a> (MAP map, int64_t val) </dt>
<dd>Histograms don't work yet. </dd>
</dl>
<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>
<p>
<p>
-Definition at line <a class="el" href="map_8h-source.html#l00019">19</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this union was generated from the following file:<ul>
+Definition at line <a class="el" href="map_8h-source.html#l00017">17</a> of file <a class="el" href="map_8h-source.html">map.h</a>.<hr>The documentation for this union was generated from the following file:<ul>
<li><a class="el" href="map_8h-source.html">map.h</a></ul>
<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>
+/* -*- linux-c -*- */
+/** @file io.c
+ * @brief I/O functions
+ */
+
/** Logs data.
* This function is compatible with printk. In fact it currently
* sends all output to vprintk, after sending "STP: ". This allows
}
+/** Lookup symbol.
+ * This simply calls the kernel function kallsyms_lookup().
+ * That function is not exported, so this workaround is required.
+ * See the kernel source, kernel/kallsyms.c for more information.
+ */
static const char * (*_stp_kallsyms_lookup)(unsigned long addr,
unsigned long *symbolsize,
unsigned long *offset,
#define STP_BUF_LEN 8191
-/* FIXME. These need to be per-cpu */
+/** Static buffer for printing */
static char _stp_pbuf[STP_BUF_LEN+1];
static int _stp_pbuf_len = STP_BUF_LEN;
+/** Print into the print buffer.
+ * Like printf, except output goes into _stp_pbuf,
+ * which will contain the null-terminated output.
+ * Safe because overflowing _stp_pbuf is not allowed.
+ * Size is limited by length of print buffer.
+ *
+ * @param fmt A variable number of args.
+ * @note Formatting output should never be done within
+ * a probe. Use at module exit time.
+ * @sa _stp_print_buf_init
+ */
+
void _stp_print_buf (const char *fmt, ...)
{
int num;
_stp_pbuf_len -= num;
}
+/** Clear the print buffer.
+ * Output from _stp_print_buf() will accumulate in the buffer
+ * until this is called.
+ */
+
void _stp_print_buf_init (void)
{
_stp_pbuf_len = STP_BUF_LEN;
_stp_pbuf[0] = 0;
}
+/** Print addresses symbolically into the print buffer.
+ * @param fmt A variable number of args.
+ * @param address The address to lookup.
+ * @note Formatting output should never be done within
+ * a probe. Use at module exit time.
+ */
+
void _stp_print_symbol(const char *fmt, unsigned long address)
{
char *modname;
}
}
+/** Get the current return address.
+ * Call from kprobes (not jprobes).
+ * @param regs The pt_regs saved by the kprobe.
+ * @return The return address saved in esp or rsp.
+ * @note i386 and x86_64 only.
+ */
unsigned long cur_ret_addr (struct pt_regs *regs)
{
* @brief Implements maps (associative arrays) and lists
*/
-
static int map_sizes[] = {
sizeof(struct map_node_int64),
sizeof(struct map_node_stat),
/* -*- linux-c -*- */
/** @file map.h
- * @brief Header file for maps and lists
+ * @brief Header file for maps and lists
*/
#include <linux/types.h>
-/** Statistics are stored in this struct
-*/
+/** Statistics are stored in this struct */
typedef struct {
int64_t count;
int64_t sum;
int64_t histogram[BUCKETS];
} stat;
-/** Keys are either longs or char *
- */
+/** Keys are either longs or char * */
union key_data {
long val;
char *str;
};
+/** keys can be longs or strings */
enum keytype { NONE, LONG, STR } __attribute__ ((packed));
+/** values can be either int64, stats or strings */
enum valtype { INT64, STAT, STRING, END };
-/** all map nodes have the following structure
-*/
+
+/** basic map element */
struct map_node {
+ /** list of other nodes in the map */
struct list_head lnode;
- struct hlist_node hnode;
+ /** list of nodes with the same hash value */
+ struct hlist_node hnode;
union key_data key1;
union key_data key2;
enum keytype key1type;
enum keytype key2type;
};
-/* specific map nodes with data attached */
+/** map element containing int64 */
struct map_node_int64 {
struct map_node n;
int64_t val;
};
+/** map element containing string */
struct map_node_str {
struct map_node n;
char *str;
};
+/** map element containing stats */
struct map_node_stat {
struct map_node n;
stat stats;
};
/** This structure contains all information about a map.
- * It is allocated once when _stp_map_new() is called.
+ * It is allocated once when _stp_map_new() is called.
*/
struct map_root {
- enum valtype type; /** type of the values stored in the array */
- int maxnum; /** maximum number of elements allowed in the array. */
+ /** type of the values stored in the array */
+ enum valtype type;
+
+ /** maximum number of elements allowed in the array. */
+ int maxnum;
- /* current number of elements */
+ /** current number of used elements */
int num;
- /* when more than maxnum elements, wrap or discard */
+ /** when more than maxnum elements, wrap or discard? */
int no_wrap;
- /* linked list of current entries */
+ /** linked list of current entries */
struct list_head head;
- /* pool of unused entries. Used only when entries are statically allocated */
- /* at startup. */
+ /** pool of unused entries. Used only when entries are statically allocated
+ at startup. */
struct list_head pool;
- /* saved key entry for lookups */
+ /** saved key entry for lookups */
struct map_node *key;
- /* this is the creation data saved between the key functions and the */
- /* set/get functions */
+ /** this is the creation data saved between the key functions and the
+ set/get functions
+ @todo Needs to be per-cpu data for SMP support */
u_int8_t create;
enum keytype c_key1type;
enum keytype c_key2type;
union key_data c_key1;
union key_data c_key2;
- /* the hash table for this array */
+ /** the hash table for this array */
struct hlist_head hashes[HASH_TABLE_SIZE];
- /* pointer to allocated memory space */
+ /** pointer to allocated memory space. Used for freeing memory. */
void *membuf;
};
-/** All maps are of this type.
- */
+/** All maps are of this type. */
typedef struct map_root *MAP;
+/** Extracts string from key1 union */
#define key1str(ptr) (ptr->n.key1.str)
+/** Extracts string from key2 union */
#define key2str(ptr) (ptr->n.key2.str)
+/** Extracts int from key1 union */
#define key1int(ptr) (ptr->n.key1.val)
+/** Extracts int from key2 union */
#define key2int(ptr) (ptr->n.key2.val)
+/** Macro to call the proper _stp_map_key functions based on the
+ * types of the arguments.
+ * @note May cause compiler warning on some GCCs
+ */
#define _stp_map_key2(map, key1, key2) \
({ \
if (__builtin_types_compatible_p (typeof (key1), char[])) \
_stp_map_key_long_long (map, (long)(key1), (long)(key2)); \
})
+/** Macro to call the proper _stp_map_key function based on the
+ * type of the argument.
+ * @note May cause compiler warning on some GCCs
+ */
#define _stp_map_key(map, key) \
({ \
if (__builtin_types_compatible_p (typeof (key), char[])) \
_stp_map_key_long (map, (long)(key)); \
})
+/** Macro to call the proper _stp_map_set function based on the
+ * type of the argument.
+ * @note May cause compiler warning on some GCCs
+ */
#define _stp_map_set(map, val) \
({ \
if (__builtin_types_compatible_p (typeof (val), char[])) \
_stp_map_set_int64 (map, (int64_t)(val)); \
})
+/** Macro to call the proper _stp_list_add function based on the
+ * types of the argument.
+ * @note May cause compiler warning on some GCCs
+ */
#define _stp_list_add(map, val) \
({ \
if (__builtin_types_compatible_p (typeof (val), char[])) \
/* -*- linux-c -*- */
-
-/** Create a new map.
- * Maps must be created at module initialization time.
- * @param max_entries The maximum number of entries allowed. Currently that
- * will be allocated dynamically.
- * @param type Type of values stored in this map.
- * @return A MAP on success or NULL on failure.
+/** @file probes.c
+ * @brief Functions to assist loading and unloading groups of probes.
*/
-
+/** Lookup name.
+ * This simply calls the kernel function kallsyms_lookup_name().
+ * That function is not exported, so this workaround is required.
+ * See the kernel source, kernel/kallsyms.c for more information.
+ */
static unsigned long (*_stp_lookup_name)(char *name)=(void *)KALLSYMS_LOOKUP_NAME;
+/** Unregister a group of jprobes.
+ * @param probes Pointer to an array of struct jprobe.
+ * @param num_probes Number of probes in the array.
+ */
+
void _stp_unregister_jprobes (struct jprobe *probes, int num_probes)
{
int i;
dlog ("All jprobes removed\n");
}
+/** Register a group of jprobes.
+ * @param probes Pointer to an array of struct jprobe.
+ * @param num_probes Number of probes in the array.
+ * @return 0 on success.
+ */
+
int _stp_register_jprobes (struct jprobe *probes, int num_probes)
{
int i, ret ;
return ret;
}
+/** Unregister a group of kprobes.
+ * @param probes Pointer to an array of struct kprobe.
+ * @param num_probes Number of probes in the array.
+ */
+
void _stp_unregister_kprobes (struct kprobe *probes, int num_probes)
{
int i;
dlog ("All kprobes removed\n");
}
+/** Register a group of kprobes.
+ * @param probes Pointer to an array of struct kprobe.
+ * @param num_probes Number of probes in the array.
+ * @return 0 on success.
+ */
+
int _stp_register_kprobes (struct kprobe *probes, int num_probes)
{
int i, ret ;