summaryrefslogtreecommitdiff
path: root/share/man/man4/ksyms.4
blob: aa7c7c42a4aff761c6dd5ad5184ac7f865163a6a (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
.\" $OpenBSD: ksyms.4,v 1.5 2001/03/01 16:11:18 aaron Exp $
.\"
.\" Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\"    derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 24, 1998
.Dt KSYMS 4
.Os
.Sh NAME
.Nm ksyms
.Nd kernel symbol table device
.Sh SYNOPSIS
.Sy pseudo-device Nm ksyms 1
.Sh DESCRIPTION
The
.Nm /dev/ksyms
device masquerades as an
.Em a.out
executable with the symbols from the running kernel as its
symbol segment.  Use of
.Nm /dev/ksyms
requires that the boot loader preserve the kernel symbols and place
them at the end of the kernel's address space.  Any port that is capable
of using the
.Em DDB
debugger does this, even if
.Em DDB
is not configured into the kernel.
.Pp
The
.Nm /dev/ksyms
device is used to look up the symbol table name list from the running
kernel.  Because it represents the running kernel it is guaranteed
to always be up to date even if the kernel file has been changed (or
is even non-existent).  It is most useful when used in conjunction with
.Xr nlist 3
or the
.Xr kvm 3
routines (note that
.Xr kvm_open 3
and
.Xr kvm_openfiles 3
will try
.Nm /dev/ksyms
automatically if the first parameter to them is the
.Dv NULL
pointer).
.Sh FILES
.Bl -tag -width Pa -compact
.It Pa /dev/ksyms
.El
.Sh ERRORS
An open of
.Nm /dev/ksyms
will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
An open was attempted with write permissions.
.It Bq Er ENXIO
No kernel symbols were saved by the boot loader (usually because
they were removed with
.Xr strip 1 ) .
.El
.Sh SEE ALSO
.Xr kvm 3 ,
.Xr nlist 3
.Sh HISTORY
The
.Nm /dev/ksyms
device appeared in
.Ox 2.4 .
.Sh BUGS
It is not possible to
.Xr mmap 2
.Nm /dev/ksyms
because the boot loader does not load the symbol table onto a page
boundary (so it is not page aligned).  If all the boot loaders were
fixed,
.Xr mmap 2
support would be trivial.