[comp.sys.hp] Bug in HPUX 7.0 Series 300 iomap

tgl@zog.cs.cmu.edu (Tom Lane) (06/01/90)

I've found that the IOMAPMAP ioctl() request doesn't behave very
well if one hands it a file descriptor for a device special file
that is *not* an iomap(7) file (i.e., major number not 10).

If the file descriptor is for /dev/tty, the ioctl() call fails with
a return value of 0, rather than -1 as specified in the ioctl(2)
man page.  Not only that, but it neglects to set errno.

I've also tried other types of special files and gotten
errno=EINVAL, rather than ENOTTY as I would expect from the
iomap(7) man page.  Could this indicate that IOMAPMAP is
blindly taking the minor number as an IOMAP addressing spec?

The only error case that seems to be handled reasonably is where
the file descriptor references an ordinary disk file.

-- 
				tom lane
Internet: tgl@cs.cmu.edu
UUCP: <your favorite internet/arpanet gateway>!cs.cmu.edu!tgl
BITNET: tgl%cs.cmu.edu@cmuccvma
CompuServe: >internet:tgl@cs.cmu.edu

stroyan@hpfcso.HP.COM (Mike Stroyan) (06/01/90)

> I've found that the IOMAPMAP ioctl() request doesn't behave very
> well if one hands it a file descriptor for a device special file
> that is *not* an iomap(7) file (i.e., major number not 10).

The ioctl call is a way to perform driver dependent operations.  The
kernel hands the "request" and "arg" parameters from the ioctl call to
the driver.  It doesn't hand the driver number to IOMAPMAP.

> If the file descriptor is for /dev/tty, the ioctl() call fails with
> a return value of 0, rather than -1 as specified in the ioctl(2)
> man page.  Not only that, but it neglects to set errno.

The IOMAPMAP "arg" parameter from iomap.h has the same value as the
MCGETA ioctl from modem.h.  When you gave IOMAPMAP to the tty driver it
examined the "arg" value and assumed you wanted to do MCGETA, so it
didn't report an error.  Other drivers don't have a valid meaning for
the IOMAPMAP "arg" value, so they report EINVAL to say "arg is not valid".
The regular files report ENOTTY to say "ioctl is not supported".

> I've also tried other types of special files and gotten
> errno=EINVAL, rather than ENOTTY as I would expect from the
> iomap(7) man page.  Could this indicate that IOMAPMAP is
> blindly taking the minor number as an IOMAP addressing spec?

No.  Any unintended action will be from the list of ioctl args that
the receiving driver supports.

Mike Stroyan, stroyan@hpfcla.hp.com