From owner-freebsd-arch@FreeBSD.ORG Tue Jun 5 21:01:57 2012 Return-Path: Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8706810656B0; Tue, 5 Jun 2012 21:01:57 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id E88D68FC0C; Tue, 5 Jun 2012 21:01:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q55L1tOI022765; Wed, 6 Jun 2012 01:01:55 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q55L1sFR022764; Wed, 6 Jun 2012 01:01:54 +0400 (MSK) (envelope-from ache) Date: Wed, 6 Jun 2012 01:01:54 +0400 From: Andrey Chernov To: Bruce Evans Message-ID: <20120605210154.GA22370@vniz.net> Mail-Followup-To: Andrey Chernov , Bruce Evans , svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Pawel Jakub Dawidek , freebsd-arch@FreeBSD.ORG References: <201206042134.q54LYoVJ067685@svn.freebsd.org> <20120605074741.GA1391@garage.freebsd.pl> <20120605130922.GE13306@vniz.net> <20120606043731.D1124@besplex.bde.org> <20120605194102.GA21173@vniz.net> <20120606054555.U1456@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120606054555.U1456@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Pawel Jakub Dawidek , freebsd-arch@FreeBSD.ORG Subject: Re: svn commit: r236582 - head/lib/libc/stdlib 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: Tue, 05 Jun 2012 21:01:57 -0000 On Wed, Jun 06, 2012 at 06:11:01AM +1000, Bruce Evans wrote: > This is essentially unusable (so a bad idea). Instead of unconditionally > saving and restoring errno around calls to free(), portable POSIX code > can soon use a messy ifdef to avoid doing this in some cases, but still > has to do it in other cases. The results is just bloat and complexity > at the source level: It looks like they now consider POSIX as moving target where previous POSIX versions compatibility is not so essential to care about much. I don't have other interpretation of their decision to suddenly accept free() as not modifying errno. Since they clearly indicate code differences for old and new standard, they are well aware of them and of resulting code bloating. > However, free() is currently not careful about errno. It begins with > an optional utrace() call, and this can in theory fail with errno ENOMEM > even if there are no bugs in malloc() (all other errors from utrace() > indicate bugs in the caller, assuming that the list of errnos in its man > page is complete). malloc.c makes a few other sys(lib?)calls and never > saves errno. I don't know if the others are reachable from free(). I fill PR about that: http://www.freebsd.org/cgi/query-pr.cgi?pr=168719 -- http://ache.vniz.net/