---
name: "nvme_get_nsid"
section: "2"
platform: "linux"
package: "libnvme-dev"
version: "1.13-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/nvme_get_nsid"
---

# nvme\_get\_nsid(2)

Retrieve the NSID from a namespace file descriptor

## NAME

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

## SYNOPSIS

**int nvme\_get\_nsid** **(int fd** *,* **\_\_u32 \*nsid** *);*

## ARGUMENTS

- fd

  File descriptor of nvme namespace

- 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 -1 with errno set otherwise.
