1.\" $OpenBSD: ksyms.4,v 1.11 2004/03/21 17:05:33 miod 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 August 24, 1998 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 31.Po 32.Em a.out 33or 34.Em ELF , 35depending on the platform 36.Pc 37with the symbols from the running kernel as its symbol segment. 38Use of 39.Pa /dev/ksyms 40requires that the boot loader preserve the kernel symbols and place 41them at the end of the kernel's address space. 42.Pp 43The 44.Pa /dev/ksyms 45device is used to look up the symbol table name list from the running 46kernel. 47Because it represents the running kernel it is guaranteed 48to always be up to date even if the kernel file has been changed (or 49is even non-existent). 50It is most useful when used in conjunction with 51.Xr nlist 3 52or the 53.Xr kvm 3 54routines (note that 55.Xr kvm_open 3 56and 57.Xr kvm_openfiles 3 58will try 59.Pa /dev/ksyms 60automatically if the first parameter to them is the 61.Dv NULL 62pointer). 63.Sh FILES 64.Bl -tag -width Pa -compact 65.It Pa /dev/ksyms 66.El 67.Sh ERRORS 68An open of 69.Pa /dev/ksyms 70will fail if: 71.Bl -tag -width Er 72.It Bq Er EPERM 73An open was attempted with write permissions. 74.It Bq Er ENXIO 75No kernel symbols were saved by the boot loader (usually because 76they were removed with 77.Xr strip 1 ) , 78or the kernel has been compiled without a 79.Dq pseudo-device ksyms 80line. 81.El 82.Sh SEE ALSO 83.Xr kvm 3 , 84.Xr nlist 3 85.Sh HISTORY 86The 87.Pa /dev/ksyms 88device appeared in 89.Ox 2.4 . 90.Sh BUGS 91It is not possible to 92.Xr mmap 2 93.Pa /dev/ksyms 94because the boot loader does not load the symbol table onto a page 95boundary (so it is not page aligned). 96If all the boot loaders were fixed, 97.Xr mmap 2 98support would be trivial. 99