From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Woodhouse Subject: Re: [PATCH] remove TCGETS Date: Tue, 28 Oct 2003 15:56:37 +0000 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1067356596.15551.448.camel@hades.cambridge.redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Matthew Wilcox , Peter Braam , intermezzo-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Return-path: Received: from pentafluge.infradead.org ([213.86.99.235]:176 "EHLO pentafluge.infradead.org") by vger.kernel.org with ESMTP id S264022AbTJ1P4s (ORCPT ); Tue, 28 Oct 2003 10:56:48 -0500 To: Bryan Henderson , torvalds@osdl.org In-Reply-To: List-Id: linux-fsdevel.vger.kernel.org Linus; executive decision required please: On Thu, 2003-08-14 at 08:54 -0700, Bryan Henderson wrote: > : > >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. And what's more important than convention is a ruling from the Chief Penguin. LTP is bitching at me because my file system returns -EINVAL to all ioctls instead of -ENOTTY. Do I... 1. Make my file system return -ENOTTY. 2. Make LTP accept -EINVAL instead of -ENOTTY on an invalid ioctl. 3. Make LTP accept _either_ -EINVAL or -ENOTTY in that case. I favour either #1 or #2 and don't care which. I dislike #3 because we should be consistent. cf. http://www.opengroup.org/onlinepubs/007904975/functions/ioctl.html -- dwmw2