From owner-freebsd-arch@FreeBSD.ORG Mon Feb 27 09:04:23 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 B296116A420 for ; Mon, 27 Feb 2006 09:04:23 +0000 (GMT) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CEBA43D53 for ; Mon, 27 Feb 2006 09:04:21 +0000 (GMT) (envelope-from andre@freebsd.org) Received: (qmail 7038 invoked from network); 27 Feb 2006 08:58:26 -0000 Received: from c00l3r.networx.ch (HELO freebsd.org) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 27 Feb 2006 08:58:26 -0000 Message-ID: <4402C09C.C3FB0064@freebsd.org> Date: Mon, 27 Feb 2006 10:04:28 +0100 From: Andre Oppermann X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Gleb Smirnoff References: <20060227083815.GW55275@cell.sick.ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: arch@FreeBSD.org, yar@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:04:23 -0000 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; > > 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? I don't think ENOTTY is appropriate here even though the comment to this error code would fit. But the define still says no TTY which is totally unrelated and confusing. -- Andre