Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libkvm/kvm_nlist.3
Show All 26 Lines | |||||
.\" 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. | ||||
.\" | .\" | ||||
.\" @(#)kvm_nlist.3 8.1 (Berkeley) 6/4/93 | .\" @(#)kvm_nlist.3 8.1 (Berkeley) 6/4/93 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd June 4, 1993 | .Dd November 27, 2015 | ||||
.Dt KVM_NLIST 3 | .Dt KVM_NLIST 3 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm kvm_nlist | .Nm kvm_nlist , | ||||
.Nm kvm_nlist2 | |||||
.Nd retrieve symbol table names from a kernel image | .Nd retrieve symbol table names from a kernel image | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libkvm | .Lb libkvm | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In kvm.h | .In kvm.h | ||||
.In nlist.h | .In nlist.h | ||||
.Ft int | .Ft int | ||||
.Fn kvm_nlist "kvm_t *kd" "struct nlist *nl" | .Fn kvm_nlist "kvm_t *kd" "struct nlist *nl" | ||||
.Ft int | |||||
.Fn kvm_nlist2 "kvm_t *kd" "struct kvm_nlist *nl" | |||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Fn kvm_nlist | .Fn kvm_nlist | ||||
function retrieves the symbol table entries indicated by the name list argument | function retrieves the symbol table entries indicated by the name list argument | ||||
.Fa \&nl . | .Fa \&nl . | ||||
This argument points to an array of nlist structures, terminated by | This argument points to an array of nlist structures, terminated by | ||||
an entry whose n_name field is | an entry whose | ||||
.Fa n_name | |||||
field is | |||||
.Dv NULL | .Dv NULL | ||||
(see | (see | ||||
.Xr nlist 3 ) . | .Xr nlist 3 ) . | ||||
Each symbol is looked up using the n_name field, and if found, the | Each symbol is looked up using the | ||||
corresponding n_type and n_value fields are filled in. | .Fa n_name | ||||
field, and if found, the | |||||
corresponding | |||||
.Fa n_type | |||||
and | |||||
.Fa n_value | |||||
fields are filled in. | |||||
These fields are set | These fields are set | ||||
to 0 if the symbol is not found. | to 0 if the symbol is not found. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Xr kldsym 2 | .Xr kldsym 2 | ||||
system call is used to locate the symbol. | system call is used to locate symbols in live kernels. | ||||
This is a less than perfect | This is a less than perfect | ||||
emulation of the nlist values but has the advantage of being aware of kernel | emulation of the nlist values but has the advantage of being aware of kernel | ||||
modules and is reasonably fast. | modules and is reasonably fast. | ||||
.Pp | |||||
The | |||||
.Fn kvm_nlist2 | |||||
function retrieves the symbol table entries indicated by the name list argument | |||||
.Fa nl . | |||||
This argument points to an array of | |||||
.Vt "struct kvm_nlist" | |||||
structures, | |||||
terminated by an entry whose | |||||
.Fa n_name | |||||
field is | |||||
.Dv NULL | |||||
These structures are similar to the nlist structures used by | |||||
.Fn kvm_nlist | |||||
except that the | |||||
.Fa n_value | |||||
field uses a different type | |||||
.Pq Vt kvaddr_t | |||||
to avoid truncation when examining non-native kernel images. | |||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||
The | The | ||||
.Fn kvm_nlist | .Fn kvm_nlist | ||||
function returns the number of invalid entries found. | and | ||||
.Fn kvm_nlist2 | |||||
functions return the number of invalid entries found. | |||||
If the kernel symbol table was unreadable, -1 is returned. | If the kernel symbol table was unreadable, -1 is returned. | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr kldsym 2 , | .Xr kldsym 2 , | ||||
.Xr kvm 3 , | .Xr kvm 3 , | ||||
.Xr kvm_close 3 , | .Xr kvm_close 3 , | ||||
.Xr kvm_getargv 3 , | .Xr kvm_getargv 3 , | ||||
.Xr kvm_getenvv 3 , | .Xr kvm_getenvv 3 , | ||||
.Xr kvm_geterr 3 , | .Xr kvm_geterr 3 , | ||||
.Xr kvm_getprocs 3 , | .Xr kvm_getprocs 3 , | ||||
.Xr kvm_native 3 , | |||||
.Xr kvm_open 3 , | .Xr kvm_open 3 , | ||||
.Xr kvm_openfiles 3 , | .Xr kvm_openfiles 3 , | ||||
.Xr kvm_read 3 , | .Xr kvm_read 3 , | ||||
.Xr kvm_write 3 | .Xr kvm_write 3 |