diff options
Diffstat (limited to 'runtime/docs/html/alloc_8h-source.html')
-rw-r--r-- | runtime/docs/html/alloc_8h-source.html | 152 |
1 files changed, 78 insertions, 74 deletions
diff --git a/runtime/docs/html/alloc_8h-source.html b/runtime/docs/html/alloc_8h-source.html index 7d2a3310..e68fbb86 100644 --- a/runtime/docs/html/alloc_8h-source.html +++ b/runtime/docs/html/alloc_8h-source.html @@ -5,79 +5,83 @@ </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> |