]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/ksyms.4
ZFS: MFV 2.0-rc1-gfd20a8
[FreeBSD/FreeBSD.git] / share / man / man4 / ksyms.4
1 .\" Copyright (c) 2008-2009 Stacey Son <sson@FreeBSD.org>
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd August 2, 2017
31 .Dt KSYMS 4
32 .Os
33 .Sh NAME
34 .Nm ksyms
35 .Nd kernel symbol table interface
36 .Sh SYNOPSIS
37 .Cd "device ksyms"
38 .Sh DESCRIPTION
39 The
40 .Pa /dev/ksyms
41 character device provides a read-only interface to a snapshot of the kernel
42 symbol table.
43 The in-kernel symbol manager is designed to be able to handle
44 many types of symbols tables, however, only
45 .Xr elf 5
46 symbol tables are supported by this device.
47 The ELF format image contains two
48 sections: a symbol table and a corresponding string table.
49 .Bl -tag -width indent -offset indent
50 .It Dv Symbol Table
51 The SYMTAB section contains the symbol table entries present in the current
52 running kernel, including the symbol table entries of any loaded modules.
53 The symbols are ordered by the kernel module load time starting with kernel file
54 symbols first, followed by the first loaded module's symbols and so on.
55 .It Dv String Table
56 The STRTAB section contains the symbol name strings from the kernel and any
57 loaded modules that the symbol table entries reference.
58 .El
59 .Pp
60 Elf formatted symbol table data read from the
61 .Pa /dev/ksyms
62 file represents the state of the kernel at the time when the device is opened.
63 Since
64 .Pa /dev/ksyms
65 has no text or data, most of the fields are initialized to NULL.
66 The
67 .Nm
68 driver does not block the loading or unloading of modules into the kernel
69 while the
70 .Pa /dev/ksyms
71 file is open but may contain stale data.
72 .Sh FILES
73 .Bl -tag -width /dev/ksymsX
74 .It Pa /dev/ksyms
75 .El
76 .Sh ERRORS
77 An
78 .Xr open 2
79 of
80 .Pa /dev/ksyms
81 will fail if:
82 .Bl -tag -width Er
83 .It Bq Er EBUSY
84 The device is already open.
85 A process must close
86 .Pa /dev/ksyms
87 before it can be opened again.
88 .It Bq Er ENOMEM
89 There is a resource shortage in the kernel.
90 .It Bq Er ENXIO
91 The driver was unsuccessful in creating a snapshot of the kernel symbol
92 table.
93 This may occur if the kernel was in the process of loading or
94 unloading a module.
95 .El
96 .Sh SEE ALSO
97 .Xr nlist 3 ,
98 .Xr elf 5 ,
99 .Xr kldload 8
100 .Sh HISTORY
101 A
102 .Nm
103 device exists in many different operating systems.
104 This implementation is similar in function to the Solaris and NetBSD
105 .Nm
106 driver.
107 .Pp
108 The
109 .Nm
110 driver first appeared in
111 .Fx 8.0
112 to support
113 .Xr lockstat 1 .
114 .Sh AUTHORS
115 The
116 .Nm
117 driver was written by
118 .An Stacey Son Aq Mt sson@FreeBSD.org .
119 .Sh BUGS
120 Because files can be dynamically linked into the kernel at any time the symbol
121 information can vary.
122 When you open the
123 .Pa /dev/ksyms
124 file, you have access to an ELF image which represents a snapshot of the state
125 of the kernel symbol information at that instant in time.
126 Keeping the device open does not block the loading or unloading of kernel
127 modules.
128 To get a new snapshot you must close and re-open the device.
129 .Pp
130 A process is only allowed to open the
131 .Pa /dev/ksyms
132 file once at a time.
133 The process must close the
134 .Pa /dev/ksyms
135 before it is allowed to open it again.