EBADRQC
Linux / POSIXERRORNotableDeviceHIGH confidence

Invalid Request Code

Production Risk

Indicates using the wrong ioctl command for the device type.

What this means

EBADRQC (errno 56) is a Linux-specific error returned when an invalid request code is sent to a device driver or STREAMS module.

Why it happens
  1. 1Sending an ioctl request code that the driver does not support
  2. 2Using a request code from a different driver
How to reproduce

ioctl with unsupported request code.

trigger — this will error
trigger — this will error
// Wrong ioctl command for this device
ioctl(fd, WRONG_DRIVER_CMD, &arg);
// Returns -1, errno = EBADRQC

expected output

Invalid request code (EBADRQC)

Fix

Use the correct ioctl command for the device

WHEN When ioctl returns EBADRQC

Use the correct ioctl command for the device
// Check device documentation for valid ioctl codes
// Include the correct device header
#include <linux/mydevice.h>
ioctl(fd, MYDEVICE_VALID_CMD, &arg);

Why this works

Each driver defines its own ioctl command codes in its kernel header.

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