Re: [PATCH] remove TCGETS

Bryan Henderson <[email protected]> Thu, 14 Aug 2003 08:54:07 -0700
Newsgroups gmane.linux.file-systems,gmane.comp.file-systems.intermezzo.devel
Message-ID <OF433C3E9C.A7683D5B-ON87256D82.0055FE1E-88256D82.00573FAD@us.ibm.com>



>If an underlying device driver detects an error, then ioctl() shall fail
if:
>
>[EINVAL]
>    The request or arg argument is not valid for this device.
>...
>[ENOTTY]
>    The fildes argument is not associated with a STREAMS device that
>    accepts control functions.
>...
>Maybe we need to start removing ENOTTY returns from ioctl handlers.

How do you reach that conclusion from the above?  The specification is
ambiguous.  When you send a TCGETS to a regular file, both the EINVAL and
ENOTTY cases hold.

The actual spec is even more ambiguous, because it says at the top of the
quoted section that the function described therein doesn't apply to
anything but a STREAMS device, and therefore the implementation can do
anything at all when you send a TCGETS to a regular file and still conform
to that spec.

What's much more important than a spec, though, is convention.  There are
probably programs that issue an ioctl to a file descriptor to find out if
it is a terminal or not and expect the conventional ENOTTY for the "no"
case and consider EINVAL an actual error.

--
Bryan Henderson                  IBM Almaden Research Center
San Jose CA                                      Filesystems

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html