---
name: "libnvme_get_nsid-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_get_nsid-libnvme3"
---

# libnvme\_get\_nsid-libnvme3(2)

Retrieve the NSID from a namespace file descriptor

## NAME

libnvme\_get\_nsid - Retrieve the NSID from a namespace file descriptor

## SYNOPSIS

**int libnvme\_get\_nsid** **(struct libnvme\_transport\_handle \*hdl** *,* **\_\_u32 \*nsid** *);*

## ARGUMENTS

- hdl

  Transport handle

- nsid

  User pointer to namespace id

## DESCRIPTION

This should only be sent to namespace handles, not to controllers. The kernel's interface returns the nsid as the return value. This is unfortunate for many architectures that are incapable of allowing distinguishing a namespace id \> 0x80000000 from a negative error number.

## RETURN

0 if *nsid* was set successfully or negative error code otherwise.
