summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/alloc_8h-source.html
blob: 42be2b627494886ca855fce324deb04dd0307bb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!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>
<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&nbsp;
<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>
</html>