xref: /openbsd/share/man/man4/ksyms.4 (revision cecf84d4)
1.\" $OpenBSD: ksyms.4,v 1.13 2013/11/01 12:08:51 fgsch Exp $
2.\"
3.\" Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: November 1 2013 $
18.Dt KSYMS 4
19.Os
20.Sh NAME
21.Nm ksyms
22.Nd kernel symbol table device
23.Sh SYNOPSIS
24.Cd "pseudo-device ksyms" Op Ar count
25.Sh DESCRIPTION
26The
27.Pa /dev/ksyms
28device masquerades as an
29.Ox
30native executable with the symbols from the running kernel as its symbol segment.
31Use of
32.Pa /dev/ksyms
33requires that the boot loader preserve the kernel symbols and place
34them at the end of the kernel's address space.
35.Pp
36The
37.Pa /dev/ksyms
38device is used to look up the symbol table name list from the running
39kernel.
40Because it represents the running kernel it is guaranteed
41to always be up to date even if the kernel file has been changed (or
42is even non-existent).
43It is most useful when used in conjunction with
44.Xr nlist 3
45or the
46.Xr kvm 3
47routines (note that
48.Xr kvm_open 3
49and
50.Xr kvm_openfiles 3
51will try
52.Pa /dev/ksyms
53automatically if the first parameter to them is the
54.Dv NULL
55pointer).
56.Sh FILES
57.Bl -tag -width Pa -compact
58.It Pa /dev/ksyms
59.El
60.Sh ERRORS
61An open of
62.Pa /dev/ksyms
63will fail if:
64.Bl -tag -width Er
65.It Bq Er EPERM
66An open was attempted with write permissions.
67.It Bq Er ENXIO
68No kernel symbols were saved by the boot loader (usually because
69they were removed with
70.Xr strip 1 ) ,
71or the kernel has been compiled without a
72.Dq pseudo-device ksyms
73line.
74.El
75.Sh SEE ALSO
76.Xr kvm 3 ,
77.Xr nlist 3
78.Sh HISTORY
79The
80.Pa /dev/ksyms
81device appeared in
82.Ox 2.4 .
83.Sh BUGS
84It is not possible to
85.Xr mmap 2
86.Pa /dev/ksyms
87because the boot loader does not load the symbol table onto a page
88boundary (so it is not page aligned).
89If all the boot loaders were fixed,
90.Xr mmap 2
91support would be trivial.
92