Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kvm_nlist(3K) — OS/MP 4.1C

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kvm_open(3K)

kvm_read(3K)

nlist(3)

a.out(5)

KVM_NLIST(3K)  —  KERNEL VM LIBRARY FUNCTIONS

NAME

kvm_nlist, kvm_getnfile, kvm_addrtoname  − get entries from kernel symbol table

SYNOPSIS


#include <kvm.h>
#include <nlist.h>


int kvm_nlist(kd, nl)
kvm_t ∗kd;
struct nlist ∗nl;


int kvm_getnfile(kd)
kvm_t ∗kd;


int kvm_addrtoname(address, offset, symbol)
unsigned address;
unsigned ∗offset;
char ∗∗symbol;

DESCRIPTION

kvm_nlist() examines the symbol table from the kernel image identified by kd (see kvm_open(3K)) and selectively extracts a list of values and puts them in the array of nlist() structures pointed to by nl. The name list pointed to by nl() consists of an array of structures containing names, types and values.  The n_name field of each such structure is taken to be a pointer to a character string representing a symbol name.  The list is terminated by an entry with a NULL pointer (or a pointer to a NULL string) in the n_name field.  For each entry in nl, if the named symbol is present in the kernel symbol table, its value and type are placed in the n_value and n_type fields.  If a symbol cannot be located, the corresponding n_type field of nl() is set to zero. 

kvm_getnfile() sets up a string and symbol table from the kernel image identified by kd (see kvm_open(3K)).  Upon return, the symbol table is sorted by value. 

kvm_addrtoname() converts a kernel text address into a symbolic name.  Given a routine address address, the routine’s name is returned in symbol with the offset into the routine returned in offset. 

RETURN VALUE

Upon normal completion, kvm_nlist() returns the number of symbols that were not located in the symbol table.    If an error occurs, nlist() returns −1 and sets all of the n_type fields in members of the array pointed to by nl() to zero. 

If an error occurs, kvm_getnfile() returns −1.  Otherwise a 0 is returned. 

kvm_addrtoname() always returns 1.  If address is less than the value of any symbols, then symbol points to the name TOO LOW and offset equals address.  If address is greater than the value of any symbols, then symbol points to the name TOO HIGH and offset equals address. 

SEE ALSO

kvm_open(3K), kvm_read(3K), nlist(3), a.out(5)

Solbourne Computer, Inc.  —  4 Feb 1991

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026