blob: 4b1b110fa77ec887f6c5921743b8c058b1d7cd15 (
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
|
<table class="head">
<tr>
<td class="head-ltitle">KSYMS(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">KSYMS(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">ksyms</code> — <span class="Nd">kernel
symbol table interface</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">pseudo-device ksyms</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <span class="Pa">/dev/ksyms</span> character device provides a
read-only interface to the current kernel symbol table. It can be accessed
either as a sequential file, where it looks like an executable file but with
zero-sized text and data segments, or via <a class="Xr">ioctl(2)</a>.</p>
<p class="Pp"><span class="Pa">/dev/ksyms</span> represents the symbol table at
the time when the device is opened, and may not change until it is
closed.</p>
<p class="Pp">The in-kernel symbol manager is designed to be able to handle any
type of symbol table. However, only <a class="Xr">elf(5)</a> symbol tables
are currently dealt with.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="IOCTLS"><a class="permalink" href="#IOCTLS">IOCTLS</a></h1>
<p class="Pp">The <a class="Xr">ioctl(2)</a> command codes below are defined in
<code class="In"><<a class="In">sys/ksyms.h</a>></code>.</p>
<p class="Pp">The (third) argument to the <a class="Xr">ioctl(2)</a> should be a
pointer to the type indicated.</p>
<div class="Bd-indent">
<dl class="Bl-tag">
<dt id="KIOCGSIZE"><a class="permalink" href="#KIOCGSIZE"><code class="Dv">KIOCGSIZE</code></a>
(<var class="Vt">int</var>)</dt>
<dd>Returns the total size of the current symbol table. This should be used
when allocating a buffer to read in the whole symbol table to memory.</dd>
<dt id="KIOCGVALUE"><a class="permalink" href="#KIOCGVALUE"><code class="Dv">KIOCGVALUE</code></a>
(<var class="Vt">struct ksyms_gvalue</var>)</dt>
<dd>Returns the value for the given symbol name in a symtab-independent
fashion.
<div class="Bd Pp Bd-indent Li">
<pre>struct ksyms_gvalue {
const char *kv_name;
uint64_t kv_value;
};</pre>
</div>
<p class="Pp">The struct member <var class="Fa">kv_name</var> should be set
to the name of the requested value, and upon return
<var class="Fa">kv_value</var> contains the symbol value.</p>
</dd>
<dt id="KIOCGSYMBOL"><a class="permalink" href="#KIOCGSYMBOL"><code class="Dv">KIOCGSYMBOL</code></a>
(<var class="Vt">struct ksyms_gsymbol</var>)</dt>
<dd>Returns the complete symbol for the given symbol name.
<div class="Bd Pp Bd-indent Li">
<pre>struct ksyms_gsymbol {
const char *kg_name;
void *kg_sym;
};</pre>
</div>
<p class="Pp">The struct member <var class="Fa">kg_name</var> should be set
to the name of the requested symbol, and the found symbol will be
written to the <var class="Fa">kg_sym</var> address. It is the callers
responsibility to ensure that enough space for the symbol is
allocated.</p>
</dd>
</dl>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
<dl class="Bl-tag">
<dt><span class="Pa">/dev/ksyms</span></dt>
<dd style="width: auto;"> </dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">ioctl(2)</a>, <a class="Xr">nlist(3)</a>,
<a class="Xr">elf(5)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">A <code class="Nm">ksyms</code> device exists in many different
operating systems. This implementation is modelled in function after Solaris
<code class="Nm">ksyms</code>. This <code class="Nm">ksyms</code> driver was
written by Anders Magnusson for <span class="Ux">NetBSD</span>.</p>
<p class="Pp">The <code class="Nm">ksyms</code> driver first appeared in
<span class="Ux">NetBSD 2.0</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">July 27, 2024</td>
<td class="foot-os">NetBSD 10.1</td>
</tr>
</table>
|