From owner-freebsd-arch@FreeBSD.ORG Mon Feb 27 10:25:49 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 85AFB16A420; Mon, 27 Feb 2006 10:25:49 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8FCA343D49; Mon, 27 Feb 2006 10:25:48 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id k1RAPdIj007805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Feb 2006 13:25:40 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id k1RAPdu7007804; Mon, 27 Feb 2006 13:25:39 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 27 Feb 2006 13:25:39 +0300 From: Gleb Smirnoff To: Yar Tikhiy Message-ID: <20060227102539.GZ55275@cell.sick.ru> 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> <20060227094458.GH6435@comp.chem.msu.su> <20060227100031.GY55275@cell.sick.ru> <20060227102029.GK6435@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20060227102029.GK6435@comp.chem.msu.su> User-Agent: Mutt/1.5.6i 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 10:25:49 -0000 On Mon, Feb 27, 2006 at 01:20:30PM +0300, Yar Tikhiy wrote: Y> > Y> > Y> I'm afraid that this is a case when EINVAL is used properly: an Y> > Y> > Y> argument to ioctl doesn't make sense to a particular device. It's Y> > Y> > Y> true that EINVAL may be abused in other places though. I wish each Y> > Y> > Y> EINVAL being returned to the userland were accompanied by log(). Y> > Y> > Y> > Y> > I don't agree. EINVAL can logically fit to almost any error condition. We Y> > Y> > should fine error codes fitting better. If "ioctl doesn't make sense to a Y> > Y> > particular device", then we should say "Operation not supported by device", Y> > Y> > which is ENODEV. Y> > Y> Y> > Y> You see, it isn't ioctl itself that doesn't make sense to the device, Y> > Y> it's a single argument, ifr_reqcap. That was my point. Of course, Y> > Y> > Yes. The ioctl is correct, that's why we do not return ENOTTY. The Y> > argument is correct, that's why we do not return EINVAL. The argument Y> > is not applicable to this device, that's why I suggest to use ENODEV. Y> Y> This interpretation sounds fair to me. Did you look at other cases Y> when ENODEV was returned? How consistent were they with this one? In network code only in if_setlladdr() if the device doesn't have link level address at all. In many places throughout the kernel, in most cases close to the description. AFAIK, EINVAL is a correct choice, when argument is incorrect, for example its length differs to the expected. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE