libnvme\_open(9) libnvme API manual libnvme\_open(9)

# [NAME](#NAME)

libnvme\_open - Open an nvme controller or namespace device

# [SYNOPSIS](#SYNOPSIS)

**int libnvme\_open** **(struct libnvme\_global\_ctx \*ctx ,** **const char \*name ,** **int flags ,** **struct libnvme\_transport\_handle \*\*hdl );**

# [ARGUMENTS](#ARGUMENTS)

[ctx](#ctx)

struct libnvme\_global\_ctx object

[name](#name)

The basename of the device to open

[flags](#flags)

Flags to pass to the underlying [open(2)](/man/os/nvme-cli/open.2) call, e.g. O\_RDONLY or O\_RDONLY | O\_EXCL

[hdl](#hdl)

Transport handle to return

# [DESCRIPTION](#DESCRIPTION)

This will look for the handle in /dev/ and validate the name and filetype match linux conventions.

# [RETURN](#RETURN)

0 on success, negative error code otherwise.

libnvme\_open September 2026

---

Document: libnvme_open-libnvme3(2) from nvme-cli 3.1-r0 (Chainguard OS)
Source: https://github.com/linux-nvme/nvme-cli
