---
name: "libnvme_read_regs-libnvme3"
section: "2"
platform: "linux"
package: "nvme-cli"
version: "3.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libnvme_read_regs-libnvme3"
---

# libnvme\_read\_regs-libnvme3(2)

Read the controller registers of a PCIe controller

## NAME

libnvme\_read\_regs - Read the controller registers of a PCIe controller

## SYNOPSIS

**int libnvme\_read\_regs** **(struct libnvme\_transport\_handle \*hdl** *,* **\_\_u32 offset** *,* **void \*buf** *,* **\_\_u32 len** *);*

## ARGUMENTS

- hdl

  Transport handle

- offset

  Offset of the first register in bytes

- buf

  Buffer to store the register values

- len

  Number of bytes to read

## DESCRIPTION

Copies the register range \[*offset*, *offset* + *len*) of the controller into *buf*, using 32-bit MMIO reads. The register values are stored in little-endian byte order, as they appear in the register map. *offset* and *len* must be multiples of 4 and the range must be within the first 4 KiB of the register map.

This should only be sent to controller handles, not to namespaces.

## RETURN

0 on success or a negative error code otherwise. -ENOTSUP indicates that the transport has no memory-mapped registers.
