summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/group__alloc.html
blob: b1151b86acf94744e603edb999359698ed306371 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!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: Memory Functions</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&nbsp;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&nbsp;List</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>Memory Functions</h1>Basic malloc/calloc/free functions.  
<a href="#_details">More...</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 &nbsp;</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="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__alloc.html#ga1">_stp_alloc</a> (size_t len)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocates memory within a probe.  <a href="#ga1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__alloc.html#ga2">_stp_calloc</a> (size_t len)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocates and clears memory within a probe.  <a href="#ga2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__alloc.html#ga3">_stp_valloc</a> (size_t len)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocates and clears memory outside a probe.  <a href="#ga3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__alloc.html#ga4">_stp_free</a> (void *ptr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees memory allocated by _stp_alloc or _stp_calloc.  <a href="#ga4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__alloc.html#ga5">_stp_vfree</a> (void *ptr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees memory allocated by _stp_valloc.  <a href="#ga5"></a><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="ga0" doxytag="alloc::_stp_error"></a>
enum errorcode&nbsp;</td><td class="memItemRight" valign="bottom"><b>_stp_error</b> = ERR_NONE</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Basic malloc/calloc/free functions. 
<p>
These will be changed so that memory allocation errors will call a handler. The default will send a signal to the user-space daemon that will trigger the module to be unloaded. <p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000001">Todo:</a></b></dt><dd>Need error handling for memory allocations</dd></dl>
<p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000001">Todo:</a></b></dt><dd>Some of these currently use kmalloc (GFP_ATOMIC) for small allocations. This should be evaluated for performance and stability.</dd></dl>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga1" doxytag="alloc.c::_stp_alloc"></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* _stp_alloc           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>len</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Allocates memory within a probe. 
<p>
This is used for small allocations from within a running probe where the process cannot sleep. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>len</em>&nbsp;</td><td>Number of bytes to allocate. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>a valid pointer on success or NULL on failure. </dd></dl>
<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_8c-source.html#l00031">31</a> of file <a class="el" href="alloc_8c-source.html">alloc.c</a>.
<p>
Referenced by <a class="el" href="alloc_8c-source.html#l00047">_stp_calloc()</a>, and <a class="el" href="map_8c-source.html#l00590">_stp_map_set_str()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga2" doxytag="alloc.c::_stp_calloc"></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* _stp_calloc           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>len</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Allocates and clears memory within a probe. 
<p>
This is used for small allocations from within a running probe where the process cannot sleep. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>len</em>&nbsp;</td><td>Number of bytes to allocate. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>a valid pointer on success or NULL on failure. </dd></dl>
<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_8c-source.html#l00047">47</a> of file <a class="el" href="alloc_8c-source.html">alloc.c</a>.
<p>
References <a class="el" href="alloc_8c-source.html#l00031">_stp_alloc()</a>.
<p>
Referenced by <a class="el" href="map_8c-source.html#l00691">_stp_map_set_stat()</a>, and <a class="el" href="map_8c-source.html#l00590">_stp_map_set_str()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga4" doxytag="alloc.c::_stp_free"></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 _stp_free           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>ptr</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Frees memory allocated by _stp_alloc or _stp_calloc. 
<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>ptr</em>&nbsp;</td><td>pointer to memory to free </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="alloc_8c-source.html#l00076">76</a> of file <a class="el" href="alloc_8c-source.html">alloc.c</a>.
<p>
Referenced by <a class="el" href="map_8c-source.html#l00831">_stp_list_clear()</a>, <a class="el" href="map_8c-source.html#l00118">_stp_map_key_del()</a>, and <a class="el" href="map_8c-source.html#l00590">_stp_map_set_str()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga3" doxytag="alloc.c::_stp_valloc"></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* _stp_valloc           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>len</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Allocates and clears memory outside a probe. 
<p>
This is typically used in the module initialization to allocate new maps, lists, etc. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>len</em>&nbsp;</td><td>Number of bytes to allocate. </td></tr>
  </table>
</dl>
<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_8c-source.html#l00062">62</a> of file <a class="el" href="alloc_8c-source.html">alloc.c</a>.
<p>
Referenced by <a class="el" href="map_8c-source.html#l00057">_stp_map_new()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga5" doxytag="alloc.c::_stp_vfree"></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 _stp_vfree           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>ptr</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Frees memory allocated by _stp_valloc. 
<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>ptr</em>&nbsp;</td><td>pointer to memory to free </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="alloc_8c-source.html#l00086">86</a> of file <a class="el" href="alloc_8c-source.html">alloc.c</a>.
<p>
Referenced by <a class="el" href="map_8c-source.html#l00205">_stp_map_del()</a>.    </td>
  </tr>
</table>
</body></html>