From owner-freebsd-arch@FreeBSD.ORG Mon Feb 27 09:45:07 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 3445016A420; Mon, 27 Feb 2006 09:45:07 +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 0C17B43D46; Mon, 27 Feb 2006 09:45:03 +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 k1R9iw7x031191; Mon, 27 Feb 2006 12:44:59 +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 k1R9iwRE031186; Mon, 27 Feb 2006 12:44:58 +0300 (MSK) (envelope-from yar) Date: Mon, 27 Feb 2006 12:44:58 +0300 From: Yar Tikhiy To: Gleb Smirnoff Message-ID: <20060227094458.GH6435@comp.chem.msu.su> References: <20060227083815.GW55275@cell.sick.ru> <20060227091417.GF6435@comp.chem.msu.su> <20060227083815.GW55275@cell.sick.ru> <4402C09C.C3FB0064@freebsd.org> <20060227093431.GX55275@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060227093431.GX55275@cell.sick.ru> User-Agent: Mutt/1.5.9i Cc: arch@FreeBSD.org, Andre Oppermann , 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:45:07 -0000 On Mon, Feb 27, 2006 at 12:34:31PM +0300, Gleb Smirnoff wrote: > Andre, Yar, > > On Mon, Feb 27, 2006 at 10:04:28AM +0100, Andre Oppermann wrote: > A> > I prefer this variant: > A> > > A> > if (ifp->if_ioctl == NULL) > A> > return (ENOTTY); > A> > if (ifr->ifr_reqcap & ~ifp->if_capabilities) > A> > return (ENODEV); > A> > > A> > Any objections? [...] > Y> I'm afraid that this is a case when EINVAL is used properly: an > Y> argument to ioctl doesn't make sense to a particular device. It's > Y> true that EINVAL may be abused in other places though. I wish each > Y> EINVAL being returned to the userland were accompanied by log(). > > I don't agree. EINVAL can logically fit to almost any error condition. We > should fine error codes fitting better. If "ioctl doesn't make sense to a > particular device", then we should say "Operation not supported by device", > which is ENODEV. You see, it isn't ioctl itself that doesn't make sense to the device, it's a single argument, ifr_reqcap. That was my point. Of course, I won't insist on it because the traditional errno is getting very limited under the present conditions anyway. -- Yar