Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Feb 2006 12:14:17 +0300
From:      Yar Tikhiy <yar@comp.chem.msu.su>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        arch@FreeBSD.org, jlemon@FreeBSD.org
Subject:   Re: changing EINVAL for SIOCSIFCAP to something else
Message-ID:  <20060227091417.GF6435@comp.chem.msu.su>
In-Reply-To: <20060227083815.GW55275@cell.sick.ru>
References:  <20060227083815.GW55275@cell.sick.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 27, 2006 at 11:38:15AM +0300, Gleb Smirnoff wrote:
>   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;

I'm afraid that this is a case when EINVAL is used properly: an
argument to ioctl doesn't make sense to a particular device.  It's
true that EINVAL may be abused in other places though.  I wish each
EINVAL being returned to the userland were accompanied by log().

-- 
Yar



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