Date: Mon, 27 Feb 2006 11:38:15 +0300 From: Gleb Smirnoff <glebius@FreeBSD.org> To: arch@FreeBSD.org Cc: yar@FreeBSD.org, jlemon@FreeBSD.org Subject: changing EINVAL for SIOCSIFCAP to something else Message-ID: <20060227083815.GW55275@cell.sick.ru>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060227083815.GW55275>