RHEL6: 32-bits compatibility for ioctl BLKSSZGET, returns EINVAL ("Invalid argument") instead of ENOTTY ("Inappropriate ioctl for device")

Solution Unverified - Updated -

Issue

On RHEL6, an application compiled for 32-bits on a 64-bit system using the BLKSSZGET ioctl returns an invalid error code when the device argument is a normal file instead of a block device.
On RHEL6, the errno returned is EINVAL == 22 ("Invalid argument") when it should be ENOTTY == 25 ("Inappropriate ioctl for device").
In addition to the invalid errno, a misleading log message is generated.
This problem does not occur on RHEL5 or on RHEL6 in 64-bit mode.

Environment

  • Red Hat Enterprise Linux (RHEL) 6
  • program compiled for 32-bit on 64-bit system using BLKSSZGET or similar ioctl

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content