svn commit: r277543 - projects/ifnet/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Fri Jan 23 02:20:40 UTC 2015


  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.


More information about the svn-src-projects mailing list