Changeset View
Changeset View
Standalone View
Standalone View
head/share/man/man4/ksyms.4
Show All 21 Lines | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" 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 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd April 5, 2009 | .Dd August 2, 2017 | ||||
.Dt KSYMS 4 | .Dt KSYMS 4 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm ksyms | .Nm ksyms | ||||
.Nd kernel symbol table interface | .Nd kernel symbol table interface | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.Cd "device ksyms" | .Cd "device ksyms" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
Show All 25 Lines | |||||
.Pa /dev/ksyms | .Pa /dev/ksyms | ||||
has no text or data, most of the fields are initialized to NULL. | has no text or data, most of the fields are initialized to NULL. | ||||
The | The | ||||
.Nm | .Nm | ||||
driver does not block the loading or unloading of modules into the kernel | driver does not block the loading or unloading of modules into the kernel | ||||
while the | while the | ||||
.Pa /dev/ksyms | .Pa /dev/ksyms | ||||
file is open but may contain stale data. | file is open but may contain stale data. | ||||
.Sh IOCTLS | |||||
The | |||||
.Xr ioctl 2 | |||||
command codes below are defined in | |||||
.Aq Pa sys/ksyms.h . | |||||
.Pp | |||||
The (third) argument to the | |||||
.Xr ioctl 2 | |||||
should be a pointer to the type indicated. | |||||
.Bl -tag -width indent -offset indent | |||||
.It Dv KIOCGSIZE (size_t) | |||||
Returns the total size of the current symbol table. | |||||
This can be used when allocating a buffer to make a copy of | |||||
the kernel symbol table. | |||||
.It Dv KIOCGADDR (void *) | |||||
Returns the address of the kernel symbol table mapped in | |||||
the process memory. | |||||
.El | |||||
.Sh FILES | .Sh FILES | ||||
.Bl -tag -width /dev/ksymsX | .Bl -tag -width /dev/ksymsX | ||||
.It Pa /dev/ksyms | .It Pa /dev/ksyms | ||||
.El | .El | ||||
.Sh ERRORS | .Sh ERRORS | ||||
An | An | ||||
.Xr open 2 | .Xr open 2 | ||||
of | of | ||||
Show All 9 Lines | |||||
There is a resource shortage in the kernel. | There is a resource shortage in the kernel. | ||||
.It Bq Er ENXIO | .It Bq Er ENXIO | ||||
The driver was unsuccessful in creating a snapshot of the kernel symbol | The driver was unsuccessful in creating a snapshot of the kernel symbol | ||||
table. | table. | ||||
This may occur if the kernel was in the process of loading or | This may occur if the kernel was in the process of loading or | ||||
unloading a module. | unloading a module. | ||||
.El | .El | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr ioctl 2 , | |||||
.Xr nlist 3 , | .Xr nlist 3 , | ||||
.Xr elf 5 , | .Xr elf 5 , | ||||
.Xr kldload 8 | .Xr kldload 8 | ||||
.Sh HISTORY | .Sh HISTORY | ||||
A | A | ||||
.Nm | .Nm | ||||
device exists in many different operating systems. | device exists in many different operating systems. | ||||
This implementation is similar in function to the Solaris and NetBSD | This implementation is similar in function to the Solaris and NetBSD | ||||
Show All 23 Lines | |||||
To get a new snapshot you must close and re-open the device. | To get a new snapshot you must close and re-open the device. | ||||
.Pp | .Pp | ||||
A process is only allowed to open the | A process is only allowed to open the | ||||
.Pa /dev/ksyms | .Pa /dev/ksyms | ||||
file once at a time. | file once at a time. | ||||
The process must close the | The process must close the | ||||
.Pa /dev/ksyms | .Pa /dev/ksyms | ||||
before it is allowed to open it again. | before it is allowed to open it again. | ||||
.Pp | |||||
The | |||||
.Nm | |||||
driver uses the calling process' memory address space to store the snapshot. | |||||
.Xr ioctl 2 | |||||
can be used to get the memory address where the symbol table is stored to | |||||
save kernel memory. | |||||
.Xr mmap 2 | |||||
may also be used but it will map it to another address. |