From owner-freebsd-arch@FreeBSD.ORG Mon Feb 27 09:14:30 2006 Return-Path: X-Original-To: arch@FreeBSD.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1AB1116A420; Mon, 27 Feb 2006 09:14:30 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64BFF43D49; Mon, 27 Feb 2006 09:14:24 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.3/8.13.3) with ESMTP id k1R9EIp9030766; Mon, 27 Feb 2006 12:14:18 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.3/8.13.3/Submit) id k1R9EI6G030765; Mon, 27 Feb 2006 12:14:18 +0300 (MSK) (envelope-from yar) Date: Mon, 27 Feb 2006 12:14:17 +0300 From: Yar Tikhiy To: Gleb Smirnoff Message-ID: <20060227091417.GF6435@comp.chem.msu.su> References: <20060227083815.GW55275@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060227083815.GW55275@cell.sick.ru> User-Agent: Mutt/1.5.9i Cc: arch@FreeBSD.org, jlemon@FreeBSD.org Subject: Re: changing EINVAL for SIOCSIFCAP to something else X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2006 09:14:30 -0000 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