diff options
Diffstat (limited to 'runtime/docs/html/alloc_8c-source.html')
-rw-r--r-- | runtime/docs/html/alloc_8c-source.html | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/runtime/docs/html/alloc_8c-source.html b/runtime/docs/html/alloc_8c-source.html deleted file mode 100644 index 4e76adbb..00000000 --- a/runtime/docs/html/alloc_8c-source.html +++ /dev/null @@ -1,101 +0,0 @@ -<!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: alloc.c Source File</title> -<link href="doxygen.css" rel="stylesheet" type="text/css"> -</head><body> -<!-- Generated by Doxygen 1.4.1 --> -<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> -<h1>alloc.c</h1><a href="alloc_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _ALLOC_C_</span> -00002 <span class="preprocessor"></span><span class="preprocessor">#define _ALLOC_C_</span> -00003 <span class="preprocessor"></span> -00004 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span> -00005 <span class="comment">/** @file alloc.c</span> -00006 <span class="comment"> * @brief Memory functions.</span> -00007 <span class="comment"> */</span><span class="comment"></span> -00008 <span class="comment">/** @addtogroup alloc Memory Functions</span> -00009 <span class="comment"> * Basic malloc/calloc/free functions. These will be changed so </span> -00010 <span class="comment"> * that memory allocation errors will call a handler. The default will</span> -00011 <span class="comment"> * send a signal to the user-space daemon that will trigger the module to</span> -00012 <span class="comment"> * be unloaded.</span> -00013 <span class="comment"> * @todo Need error handling for memory allocations</span> -00014 <span class="comment"> * @todo Some of these currently use kmalloc (GFP_ATOMIC) for</span> -00015 <span class="comment"> * small allocations. This should be evaluated for performance</span> -00016 <span class="comment"> * and stability.</span> -00017 <span class="comment"> * @{</span> -00018 <span class="comment"> */</span> -00019 -00020 <span class="keyword">enum</span> errorcode { ERR_NONE=0, ERR_NO_MEM }; -00021 <span class="keyword">enum</span> errorcode _stp_error = ERR_NONE; -00022 <span class="comment"></span> -00023 <span class="comment">/** Allocates memory within a probe.</span> -00024 <span class="comment"> * This is used for small allocations from within a running</span> -00025 <span class="comment"> * probe where the process cannot sleep. </span> -00026 <span class="comment"> * @param len Number of bytes to allocate.</span> -00027 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span> -00028 <span class="comment"> * @bug Currently uses kmalloc (GFP_ATOMIC).</span> -00029 <span class="comment"> */</span> -00030 -<a name="l00031"></a><a class="code" href="group__alloc.html#ga1">00031</a> <span class="keywordtype">void</span> *<a class="code" href="group__alloc.html#ga1">_stp_alloc</a>(size_t len) -00032 { -00033 <span class="keywordtype">void</span> *ptr = kmalloc(len, GFP_ATOMIC); -00034 <span class="keywordflow">if</span> (unlikely(ptr == NULL)) -00035 _stp_error = ERR_NO_MEM; -00036 <span class="keywordflow">return</span> ptr; -00037 } -00038 <span class="comment"></span> -00039 <span class="comment">/** Allocates and clears memory within a probe.</span> -00040 <span class="comment"> * This is used for small allocations from within a running</span> -00041 <span class="comment"> * probe where the process cannot sleep. </span> -00042 <span class="comment"> * @param len Number of bytes to allocate.</span> -00043 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span> -00044 <span class="comment"> * @bug Currently uses kmalloc (GFP_ATOMIC).</span> -00045 <span class="comment"> */</span> -00046 -<a name="l00047"></a><a class="code" href="group__alloc.html#ga2">00047</a> <span class="keywordtype">void</span> *<a class="code" href="group__alloc.html#ga2">_stp_calloc</a>(size_t len) -00048 { -00049 <span class="keywordtype">void</span> *ptr = <a class="code" href="group__alloc.html#ga1">_stp_alloc</a>(len); -00050 <span class="keywordflow">if</span> (likely(ptr)) -00051 memset(ptr, 0, len); -00052 <span class="keywordflow">return</span> ptr; -00053 } -00054 <span class="comment"></span> -00055 <span class="comment">/** Allocates and clears memory outside a probe.</span> -00056 <span class="comment"> * This is typically used in the module initialization to</span> -00057 <span class="comment"> * allocate new maps, lists, etc.</span> -00058 <span class="comment"> * @param len Number of bytes to allocate.</span> -00059 <span class="comment"> * @return a valid pointer on success or NULL on failure.</span> -00060 <span class="comment"> */</span> -00061 -<a name="l00062"></a><a class="code" href="group__alloc.html#ga3">00062</a> <span class="keywordtype">void</span> *<a class="code" href="group__alloc.html#ga3">_stp_valloc</a>(size_t len) -00063 { -00064 <span class="keywordtype">void</span> *ptr = vmalloc(len); -00065 <span class="keywordflow">if</span> (likely(ptr)) -00066 memset(ptr, 0, len); -00067 <span class="keywordflow">else</span> -00068 _stp_error = ERR_NO_MEM; -00069 <span class="keywordflow">return</span> ptr; -00070 } -00071 <span class="comment"></span> -00072 <span class="comment">/** Frees memory allocated by _stp_alloc or _stp_calloc.</span> -00073 <span class="comment"> * @param ptr pointer to memory to free</span> -00074 <span class="comment"> */</span> -00075 -<a name="l00076"></a><a class="code" href="group__alloc.html#ga4">00076</a> <span class="keywordtype">void</span> <a class="code" href="group__alloc.html#ga4">_stp_free</a>(<span class="keywordtype">void</span> *ptr) -00077 { -00078 <span class="keywordflow">if</span> (likely(ptr)) -00079 kfree(ptr); -00080 } -00081 <span class="comment"></span> -00082 <span class="comment">/** Frees memory allocated by _stp_valloc.</span> -00083 <span class="comment"> * @param ptr pointer to memory to free</span> -00084 <span class="comment"> */</span> -00085 -<a name="l00086"></a><a class="code" href="group__alloc.html#ga5">00086</a> <span class="keywordtype">void</span> <a class="code" href="group__alloc.html#ga5">_stp_vfree</a>(<span class="keywordtype">void</span> *ptr) -00087 { -00088 <span class="keywordflow">if</span> (likely(ptr)) -00089 vfree(ptr); -00090 } -00091 <span class="comment"></span> -00092 <span class="comment">/** @} */</span> -00093 <span class="preprocessor">#endif </span><span class="comment">/* _ALLOC_C_ */</span> -</pre></div></body></html> |