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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
<!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: io.c File Reference</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="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>io.c File Reference</h1>I/O functions. <a href="#_details">More...</a>
<p>
<p>
<a href="io_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0" doxytag="io.c::STP_BUF_LEN"></a>
#define </td><td class="memItemRight" valign="bottom"><b>STP_BUF_LEN</b> 8191</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a4">dlog</a> (const char *fmt,...)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Logs data. <a href="#a4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a5">_stp_print_buf</a> (const char *fmt,...)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Print into the print buffer. <a href="#a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a6">_stp_print_buf_init</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Clear the print buffer. <a href="#a6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a7">_stp_print_symbol</a> (const char *fmt, unsigned long address)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Print addresses symbolically into the print buffer. <a href="#a7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a8">cur_ret_addr</a> (struct pt_regs *regs)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the current return address. <a href="#a8"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static const char *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a1">_stp_kallsyms_lookup</a> )(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char **modname, char *namebuf) = (void *)KALLSYMS_LOOKUP</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Lookup symbol. <a href="#a1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2" doxytag="io.c::_stp_pbuf"></a>
static char </td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a2">_stp_pbuf</a> [8191+1]</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Static buffer for printing. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a3" doxytag="io.c::_stp_pbuf_len"></a>
static int </td><td class="memItemRight" valign="bottom"><b>_stp_pbuf_len</b> = 8191</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
I/O functions.
<p>
<p>
Definition in file <a class="el" href="io_8c-source.html">io.c</a>.<hr><h2>Function Documentation</h2>
<a class="anchor" name="a5" doxytag="io.c::_stp_print_buf"></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_print_buf </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>fmt</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap> </td>
<td class="mdname" nowrap> <em>...</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Print into the print buffer.
<p>
Like printf, except output goes into _stp_pbuf, which will contain the null-terminated output. Safe because overflowing _stp_pbuf is not allowed. Size is limited by length of print buffer.<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>fmt</em> </td><td>A variable number of args. </td></tr>
</table>
</dl>
<dl compact><dt><b>Note:</b></dt><dd>Formatting output should never be done within a probe. Use at module exit time. </dd></dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="io_8c.html#a6">_stp_print_buf_init</a> </dd></dl>
<p>
Definition at line <a class="el" href="io_8c-source.html#l00055">55</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
References <a class="el" href="io_8c-source.html#l00040">_stp_pbuf</a>.
<p>
Referenced by <a class="el" href="io_8c-source.html#l00085">_stp_print_symbol()</a>. </td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="io.c::_stp_print_buf_init"></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_print_buf_init </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Clear the print buffer.
<p>
Output from <a class="el" href="io_8c.html#a5">_stp_print_buf()</a> will accumulate in the buffer until this is called.
<p>
Definition at line <a class="el" href="io_8c-source.html#l00072">72</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
References <a class="el" href="io_8c-source.html#l00040">_stp_pbuf</a>. </td>
</tr>
</table>
<a class="anchor" name="a7" doxytag="io.c::_stp_print_symbol"></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_print_symbol </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>fmt</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>unsigned long </td>
<td class="mdname" nowrap> <em>address</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Print addresses symbolically into the print buffer.
<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>fmt</em> </td><td>A variable number of args. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>address</em> </td><td>The address to lookup. </td></tr>
</table>
</dl>
<dl compact><dt><b>Note:</b></dt><dd>Formatting output should never be done within a probe. Use at module exit time. </dd></dl>
<p>
Definition at line <a class="el" href="io_8c-source.html#l00085">85</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
References <a class="el" href="io_8c-source.html#l00031">_stp_kallsyms_lookup</a>, and <a class="el" href="io_8c-source.html#l00055">_stp_print_buf()</a>. </td>
</tr>
</table>
<a class="anchor" name="a8" doxytag="io.c::cur_ret_addr"></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">unsigned long cur_ret_addr </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">struct pt_regs * </td>
<td class="mdname1" valign="top" nowrap> <em>regs</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Get the current return address.
<p>
Call from kprobes (not jprobes). <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>regs</em> </td><td>The pt_regs saved by the kprobe. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The return address saved in esp or rsp. </dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>i386 and x86_64 only. </dd></dl>
<p>
Definition at line <a class="el" href="io_8c-source.html#l00112">112</a> of file <a class="el" href="io_8c-source.html">io.c</a>. </td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="io.c::dlog"></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 dlog </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>fmt</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap> </td>
<td class="mdname" nowrap> <em>...</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Logs data.
<p>
This function is compatible with printk. In fact it currently sends all output to vprintk, after sending "STP: ". This allows us to easily detect SystemTap output in the log file.<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>fmt</em> </td><td>A variable number of args. </td></tr>
</table>
</dl>
<dl compact><dt><b><a class="el" href="bug.html#_bug000003">Bug:</a></b></dt><dd>Lines are limited in length by printk buffer.</dd></dl>
<p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>Needs replaced with something much faster that does not use the system log. </dd></dl>
<p>
Definition at line <a class="el" href="io_8c-source.html#l00016">16</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
Referenced by <a class="el" href="map_8c-source.html#l00794">_stp_list_clear()</a>, <a class="el" href="probes_8c-source.html#l00032">_stp_register_jprobes()</a>, <a class="el" href="probes_8c-source.html#l00077">_stp_register_kprobes()</a>, <a class="el" href="probes_8c-source.html#l00018">_stp_unregister_jprobes()</a>, and <a class="el" href="probes_8c-source.html#l00063">_stp_unregister_kprobes()</a>. </td>
</tr>
</table>
<hr><h2>Variable Documentation</h2>
<a class="anchor" name="a1" doxytag="io.c::_stp_kallsyms_lookup"></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">const char*(* <a class="el" href="io_8c.html#a1">_stp_kallsyms_lookup</a>)(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char **modname, char *namebuf) = (void *)KALLSYMS_LOOKUP<code> [static]</code> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Lookup symbol.
<p>
This simply calls the kernel function kallsyms_lookup(). That function is not exported, so this workaround is required. See the kernel source, kernel/kallsyms.c for more information.
<p>
Definition at line <a class="el" href="io_8c-source.html#l00031">31</a> of file <a class="el" href="io_8c-source.html">io.c</a>.
<p>
Referenced by <a class="el" href="io_8c-source.html#l00085">_stp_print_symbol()</a>. </td>
</tr>
</table>
<hr size="1"><address style="align: right;"><small>
Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body>
</html>
|