From owner-svn-src-all@FreeBSD.ORG Mon Oct 4 17:41:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF9591065670; Mon, 4 Oct 2010 17:41:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 4B7AF8FC12; Mon, 4 Oct 2010 17:41:01 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o94Heib7067744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Oct 2010 20:40:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o94Heip7025973; Mon, 4 Oct 2010 20:40:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o94Hei1D025972; Mon, 4 Oct 2010 20:40:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 4 Oct 2010 20:40:44 +0300 From: Kostik Belousov To: Hajimu UMEMOTO Message-ID: <20101004174044.GU2392@deviant.kiev.zoral.com.ua> References: <201008130639.o7D6dsk1022779@svn.freebsd.org> <20101003184925.GA87647@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TegBI+r9roYdcP94" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_05, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211276 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2010 17:41:02 -0000 --TegBI+r9roYdcP94 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 05, 2010 at 12:30:02AM +0900, Hajimu UMEMOTO wrote: > Hi, >=20 > >>>>> On Sun, 3 Oct 2010 21:49:26 +0300 > >>>>> Kostik Belousov said: >=20 > kostikbel> I suspect there is some subtle issue with the commit present. > kostikbel> When getprotobyname_r() is unable to find the protocol, it see= ms > kostikbel> that established behaviour is to return 0 and set *protoent to= NULL. >=20 > The behavior you mentioned is questionable to me. Though I cannot > find the manpage of getprotobyname_r(3), there is following > description in the manpage of gethostbyname_r(3) on CentOS: >=20 > Glibc2 also has reentrant versions gethostbyname_r() and > gethostbyname2_r(). These return 0 on success and non-zero on > error. >=20 > When getprotobyname_r(3) is unable to find the protocol, it should be > treated as error, IMHO. My intention is that when getprotobyname_r(3) > ends up with error but errno is zero, the return code should be > non-zero (-1). >=20 > kostikbel> The getprotobyname_r() in HEAD and stable/8, when the protocol > kostikbel> cannot be found, return whatever value was present in errno at= the time > kostikbel> of the call. >=20 > In anyway, errno should be cleared. I've just committed to clear > errno for each method dispatch. >=20 > kostikbel> When run with the argument "tcp1" on Linux, I get > kostikbel> Res 0 errno 0 Success pres (nil) > kostikbel> On the recent FreeBSD I get > kostikbel> Res 25 errno 25 Inappropriate ioctl for device pres 0x0 > kostikbel> (ENOTTY is from stdio). >=20 > Now, it shows: >=20 > Res -1 errno 22 Unknown error: 0 pres 0x0 >=20 > (When strerror(3) is called with 0 for its argument, it set errno to > EINVAL.) Yes, I saw that commit. And there is a software in wild that does expect return value 0 and NULL returned pointer when protocol was not found, as opposed to some processing error. The interpretation of non-zero error code is "We did something wrong, or system configuration is wrong, etc". While zero error code and NULL pointer is perceived as "Wrong protocol name supplied". Solaris uses different API, I think we better follow Linux if we selected the Linux API variant. --TegBI+r9roYdcP94 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyqEZsACgkQC3+MBN1Mb4jaLQCg51fw0ir7iYv4G4ZTz8azNHgw P1wAnAzvFVgqbS+dViZxbBFNlrEJMroz =aFBi -----END PGP SIGNATURE----- --TegBI+r9roYdcP94--