---
name: "libnvme_open-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_open-libnvme3"
---

# libnvme\_open-libnvme3(2)

Open an nvme controller or namespace device

## NAME

libnvme\_open - Open an nvme controller or namespace device

## SYNOPSIS

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

## ARGUMENTS

- ctx

  struct libnvme\_global\_ctx object

- name

  The basename of the device to open

- flags

  Flags to pass to the underlying [open(2)](/open/2.md) call, e.g. O\_RDONLY or O\_RDONLY \| O\_EXCL

- hdl

  Transport handle to return

## DESCRIPTION

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

## RETURN

0 on success, negative error code otherwise.
