ELNRNG
Linux / POSIXERRORCriticalDeviceHIGH confidence

Link Number Out of Range

Production Risk

Rare; STREAMS multiplexing specific.

What this means

ELNRNG (errno 48) is a Linux/STREAMS-specific error returned when the link number is outside the valid range for the driver.

Why it happens
  1. 1Specifying an invalid link number in a STREAMS multiplexing ioctl
How to reproduce

STREAMS multiplexer ioctl with invalid link number.

trigger — this will error
trigger — this will error
// errno = ELNRNG from I_UNLINK with bad link number

expected output

Link number out of range (ELNRNG)

Fix

Use a valid link number returned by I_LINK

WHEN When unlinking STREAMS multiplexed streams

Use a valid link number returned by I_LINK
// Save the link ID from I_LINK
int linkid = ioctl(fd, I_LINK, lower_fd);
// Use same linkid for I_UNLINK
ioctl(fd, I_UNLINK, linkid);

Why this works

I_LINK returns the link number; use that exact value for I_UNLINK.

Sources
Official documentation ↗

Linux Programmer Manual errno(3)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors