Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jan 2015 05:20:34 +0300
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Garrett Cooper <yaneurabeya@gmail.com>
Cc:        svn-src-projects@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r277543 - projects/ifnet/sys/net
Message-ID:  <20150123022034.GR15484@FreeBSD.org>
In-Reply-To: <21EFD3A7-91CA-4FF9-BD84-C6AD847A11ED@gmail.com>
References:  <201501230002.t0N02R5W099367@svn.freebsd.org> <21EFD3A7-91CA-4FF9-BD84-C6AD847A11ED@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
  Garrett,

  of course the smallest commit to the branch gets most attention :)

On Thu, Jan 22, 2015 at 04:18:08PM -0800, Garrett Cooper wrote:
G> > Modified: projects/ifnet/sys/net/if_ethersubr.c
G> > ==============================================================================
G> > --- projects/ifnet/sys/net/if_ethersubr.c	Thu Jan 22 23:59:35 2015	(r277542)
G> > +++ projects/ifnet/sys/net/if_ethersubr.c	Fri Jan 23 00:02:26 2015	(r277543)
G> > @@ -985,7 +985,7 @@ ether_ioctl(struct ifnet *ifp, u_long co
G> > 		}
G> > 		break;
G> > 	default:
G> > -		error = EINVAL;			/* XXX netbsd has ENOTTY??? */
G> > +		error = EOPNOTSUPP;
G> > 		break;
G> > 	}
G> > 	return (error);
G> 
G> Uh, didn’t you just break the ioctl(2) ERRORS guarantee?
G> 
G>      [EBADF]            The fd argument is not a valid descriptor.
G> 
G>      [ENOTTY]           The fd argument is not associated with a character
G>                         special device.
G> 
G>      [ENOTTY]           The specified request does not apply to the kind of
G>                         object that the descriptor fd references.
G> 
G>      [EINVAL]           The request or argp argument is not valid.
G> 
G>      [EFAULT]           The argp argument points outside the process's
G>                         allocated address space.

We've got this stack:

sys_ioctl() -> ifioctl() -> if_drvioctl() -> xxx_ioctl()
				|    |
				ift_ioctl()

Where, ift_ioctl() and xxx_ioctl() are optional, and also interface ops
can be stacked. And EOPNOTSUPP is an indicator that says "I don't know the
op, but please pass it to other layer, like interface type, or down the stack".

To preserve the ioctl(2) interface, we can convert EOPNOTSUPP -> ENOTTY
at sys_ioctl() later.


-- 
Totus tuus, Glebius.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150123022034.GR15484>