---
name: "kvm_nlist"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/kvm_nlist"
---

# kvm\_nlist(3)

retrieve symbol table names from a kernel image

## NAME

**kvm\_nlist**, **kvm\_nlist2** – retrieve symbol table names from a kernel image

## LIBRARY

Kernel Data Access Library (libkvm, -lkvm)

## SYNOPSIS

**#include \<kvm.h\>**

**#include \<nlist.h\>**

*int*\

**kvm\_nlist**(*kvm\_t \*kd*, *struct nlist \*nl*);

*int*\

**kvm\_nlist2**(*kvm\_t \*kd*, *struct kvm\_nlist \*nl*);

## DESCRIPTION

The **kvm\_nlist**() function retrieves the symbol table entries indicated by the name list argument *nl*. This argument points to an array of nlist structures, terminated by an entry whose *n\_name* field is NULL (see [nlist(3)](/nlist/3.md)). Each symbol is looked up using the *n\_name* field, and if found, the corresponding *n\_type* and *n\_value* fields are filled in. These fields are set to 0 if the symbol is not found.

The [kldsym(2)](/kldsym/2.md) system call is used to locate symbols in live kernels. This is a less than perfect emulation of the nlist values but has the advantage of being aware of kernel modules and is reasonably fast.

The **kvm\_nlist2**() function retrieves the symbol table entries indicated by the name list argument *nl*. This argument points to an array of *struct kvm\_nlist* structures, terminated by an entry whose *n\_name* field is NULL These structures are similar to the nlist structures used by **kvm\_nlist**() except that the *n\_value* field uses a different type (*kvaddr\_t*) to avoid truncation when examining non-native kernel images.

## RETURN VALUES

The **kvm\_nlist**() and **kvm\_nlist2**() functions return the number of invalid entries found. If the kernel symbol table was unreadable, -1 is returned.

## SEE ALSO

[kldsym(2)](/kldsym/2.md), [kvm(3)](/kvm/3.md), [kvm\_close(3)](/kvm_close/3.md), [kvm\_getargv(3)](/kvm_getargv/3.md), [kvm\_getenvv(3)](/kvm_getenvv/3.md), [kvm\_geterr(3)](/kvm_geterr/3.md), [kvm\_getprocs(3)](/kvm_getprocs/3.md), [kvm\_native(3)](/kvm_native/3.md), [kvm\_open(3)](/kvm_open/3.md), [kvm\_openfiles(3)](/kvm_openfiles/3.md), [kvm\_read(3)](/kvm_read/3.md), [kvm\_write(3)](/kvm_write/3.md)

## HISTORY

The **kvm\_nlist2**() function first appeared in FreeBSD 11.0.
