Subject: Re: ENOTTY vs. EOPNOTSUPP vs. ENXIO
To: Alan Barrett <barrett@daisy.ee.und.ac.za>
From: Chris G. Demetriou <cgd@alpha.bostic.com>
List: current-users
Date: 07/12/1994 15:35:31
> I was trying to figure out why disklabel doesn't like vnd* devices, and
> discovered that the vnode disk driver in sys/dev/vn.c doesn't support
> the DIOC* ioctl's used by disklabel, and returns ENXIO for unsupported
> ioctl() calls.  Most of the other drivers I looked at return ENOTTY for
> unrecognised ioctl() calls, but kernfs returns EOPNOTSUPP.  Is there a
> good reason for these differences, or is it a bug?

Actually, it's a bit unclear what the appropriate behaviour is...

ENOTTY means "Inappropriate ioctl for device."  What if
an ioctl() _is_ appropriate, just isn't supported by that
device (e.g. disklabels on the vn devices).  ENOTTY should
probably occur for things like TIOCSCTTY on a vn device --
it's just not appropriate to try to set a disk to be your
controlling terminal.  8-)

EOPNOTSUPP is "Operation not supported," but it only recently
started (i.e. in kernfs, et al.) to be used for non-networking
code.  It was originally meant for "operation not supported
on socket."

ENXIO is the traditional error return for unsupported
ioctls()...


It should probably be cleaned up and made consistent,
but it could actually be difficult to distinguish
between cases where ENOTTY and EOPNOTSUPP (or ENXIO) should
be returned.


chris

------------------------------------------------------------------------------