diff options
author | hunt <hunt> | 2005-03-22 08:57:11 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-03-22 08:57:11 +0000 |
commit | b9c556e44326b40b2c927a0a5b5626332a8c9587 (patch) | |
tree | d0497c9323dedcb292d353d79fef769fa6fef210 /runtime/docs/html/alloc_8h-source.html | |
parent | 4a4753cb066f60eb09906a6021997ec280d3fdc5 (diff) | |
download | systemtap-steved-b9c556e44326b40b2c927a0a5b5626332a8c9587.tar.gz systemtap-steved-b9c556e44326b40b2c927a0a5b5626332a8c9587.tar.xz systemtap-steved-b9c556e44326b40b2c927a0a5b5626332a8c9587.zip |
*** empty log message ***
Diffstat (limited to 'runtime/docs/html/alloc_8h-source.html')
-rw-r--r-- | runtime/docs/html/alloc_8h-source.html | 124 |
1 files changed, 77 insertions, 47 deletions
diff --git a/runtime/docs/html/alloc_8h-source.html b/runtime/docs/html/alloc_8h-source.html index 42be2b62..7d2a3310 100644 --- a/runtime/docs/html/alloc_8h-source.html +++ b/runtime/docs/html/alloc_8h-source.html @@ -1,53 +1,83 @@ <!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 Source File</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</h1><a href="alloc_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a><a class="code" href="alloc_8h.html#a8">00001</a> <span class="keyword">enum</span> <a class="code" href="alloc_8h.html#a8">errorcode</a> { <a class="code" href="alloc_8h.html#a8a1">ERR_NONE</a>=0, <a class="code" href="alloc_8h.html#a8a2">ERR_NO_MEM</a> }; -<a name="l00002"></a><a class="code" href="alloc_8h.html#a0">00002</a> <span class="keyword">enum</span> <a class="code" href="alloc_8h.html#a8">errorcode</a> <a class="code" href="alloc_8h.html#a0">_stp_error</a> = <a class="code" href="alloc_8h.html#a8a1">ERR_NONE</a>; -00003 -<a name="l00012"></a><a class="code" href="alloc_8h.html#a3">00012</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> *<a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(size_t len) -00013 { -00014 <span class="keywordtype">void</span> *ptr = kmalloc(len, GFP_ATOMIC); -00015 <span class="keywordflow">if</span> (ptr == NULL) -00016 <a class="code" href="alloc_8h.html#a0">_stp_error</a> = <a class="code" href="alloc_8h.html#a8a2">ERR_NO_MEM</a>; -00017 <span class="keywordflow">return</span> ptr; -00018 } -00019 -<a name="l00028"></a><a class="code" href="alloc_8h.html#a4">00028</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> *<a class="code" href="alloc_8h.html#a4">_stp_calloc</a>(size_t len) -00029 { -00030 <span class="keywordtype">void</span> *ptr = <a class="code" href="alloc_8h.html#a3">_stp_alloc</a>(len); -00031 <span class="keywordflow">if</span> (ptr) -00032 memset(ptr, 0, len); -00033 <span class="keywordflow">return</span> ptr; -00034 } -00035 -<a name="l00043"></a><a class="code" href="alloc_8h.html#a5">00043</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> *<a class="code" href="alloc_8h.html#a5">_stp_valloc</a>(size_t len) -00044 { -00045 <span class="keywordtype">void</span> *ptr = vmalloc(len); -00046 <span class="keywordflow">if</span> (ptr) -00047 memset(ptr, 0, len); -00048 <span class="keywordflow">else</span> -00049 <a class="code" href="alloc_8h.html#a0">_stp_error</a> = <a class="code" href="alloc_8h.html#a8a2">ERR_NO_MEM</a>; -00050 <span class="keywordflow">return</span> ptr; -00051 } -00052 -<a name="l00057"></a><a class="code" href="alloc_8h.html#a6">00057</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="alloc_8h.html#a6">_stp_free</a>(<span class="keywordtype">void</span> *ptr) -00058 { -00059 <span class="keywordflow">if</span> (ptr) -00060 kfree(ptr); -00061 } -00062 -<a name="l00067"></a><a class="code" href="alloc_8h.html#a7">00067</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="alloc_8h.html#a7">_stp_vfree</a>(<span class="keywordtype">void</span> *ptr) -00068 { -00069 <span class="keywordflow">if</span> (ptr) -00070 vfree(ptr); -00071 } -</pre></div><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> +<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 } +</pre></div><hr size="1"><address style="align: right;"><small> +Generated on Tue Mar 22 00:32:02 2005 for SystemTap.</small></body> </html> |