changing EINVAL for SIOCSIFCAP to something else
Gleb Smirnoff
glebius at FreeBSD.org
Mon Feb 27 00:38:18 PST 2006
Colleagues,
I'd like to replace the unpleasant one-for-all error code
EINVAL to something else in this part of code of
src/sys/net/if.c:ifhwioctl()
case SIOCSIFCAP:
error = suser(td);
if (error)
return (error);
if (ifp->if_ioctl == NULL)
return (EOPNOTSUPP);
if (ifr->ifr_reqcap & ~ifp->if_capabilities)
return (EINVAL);
IFF_LOCKGIANT(ifp);
error = (*ifp->if_ioctl)(ifp, cmd, data);
IFF_UNLOCKGIANT(ifp);
if (error == 0)
getmicrotime(&ifp->if_lastchange);
break;
The possible variants are:
#define ENODEV 19 /* Operation not supported by device */
#define ENOTTY 25 /* Inappropriate ioctl for device */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
I prefer this variant:
if (ifp->if_ioctl == NULL)
return (ENOTTY);
if (ifr->ifr_reqcap & ~ifp->if_capabilities)
return (ENODEV);
Any objections?
--
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE
More information about the freebsd-arch
mailing list