From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH] Applying inappropriate ioctl operation on socket should return ENOTTY Date: Wed, 27 Apr 2011 08:57:37 +0200 Message-ID: <1303887457.2699.60.camel@edumazet-laptop> References: <1303882625-28115-1-git-send-email-lifongsun@gmail.com> <1303883910.2699.53.camel@edumazet-laptop> <20110427063730.GA20313@md5.ntu.edu.sg> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, netdev To: Lifeng Sun Return-path: In-Reply-To: <20110427063730.GA20313@md5.ntu.edu.sg> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Le mercredi 27 avril 2011 =C3=A0 14:37 +0800, Lifeng Sun a =C3=A9crit : > On 07:58 Wed 04/27/11 Apr, Eric Dumazet wrote: > > Really ? > >=20 > > EINVAL is ok too : Request or argp is not valid. >=20 > I'm afraid not. SUSv4 specifies, say, >=20 > int tcsetattr(int fildes, int optional_actions, > const struct termios *termios_p); >=20 > ERROR: > [EINVAL] > The optional_actions argument is not a supported value, or an > attempt was made to change an attribute represented in the > termios structure to an unsupported value. >=20 > [ENOTTY] > The file associated with fildes is not a terminal. >=20 > which means when we apply tcsetattr (implemented by ioctl) to _any_ > non-terminal file descriptor, it should set errno to ENOTTY rather > than EINVAL. >=20 You quote manpage for a library call, not a system call. If you feel your glibc doesnt implement well this, please complain to glibc maintainer.