From owner-freebsd-arch@freebsd.org Mon Oct 19 19:31:17 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C717BA19C60 for ; Mon, 19 Oct 2015 19:31:17 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5934212DB for ; Mon, 19 Oct 2015 19:31:16 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by lffy185 with SMTP id y185so120713962lff.2 for ; Mon, 19 Oct 2015 12:31:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=0pYhkgD8IcwNkdYjNA/p4SIB+2p5o2SHUhm7h5Oaaq4=; b=c/gxhyl0Y8Vwz2S6w1GgBG2wGj6eby6ilkfWcvKCGV6+qpZLU7aXGBcJ7pExgz9tVX vJcpNBdcasGIEcbI8E/nk6qMm2atQ+tjqfQoP4GRSi4//HnPYXiEqbENXaWxPU82cVxT 51+Vz35qR0zRL8dFLVjsDWGiDotigObo48Mfwe7Ha1VjcugcEEas6gB/taazx6nUig/E jmc6eQwHWKQobME/aTOYTGr8YH2ebg2gQ3TuWgF78MKRrnIqma0Be3yUW4XEBjRK7bij Ly0r37TZmgWr+L1pxhAMZMLwYXyuXBY7266t5x8ghnBz+s45PIN2Z1ZCa+NPGwYHKAXW 2Kcg== X-Gm-Message-State: ALoCoQmQH2t9II/CNs12Un0N/NTzWncA4mQH0KUVrnsiAj+fzQAHa2dXW4j5rTYHad8XbSJfeKt3 MIME-Version: 1.0 X-Received: by 10.194.80.197 with SMTP id t5mr34073523wjx.143.1445283068621; Mon, 19 Oct 2015 12:31:08 -0700 (PDT) Received: by 10.194.240.226 with HTTP; Mon, 19 Oct 2015 12:31:08 -0700 (PDT) In-Reply-To: <74F6DD3C-42F6-490B-A08E-245A1338A3E7@gmail.com> References: <74F6DD3C-42F6-490B-A08E-245A1338A3E7@gmail.com> Date: Mon, 19 Oct 2015 21:31:08 +0200 Message-ID: Subject: Re: [RFC] importing e* (embolic, estrdup, etc) functions from NetBSD (libc/libutil or libnetbsd)? From: Oliver Pinter To: NGie Cooper Cc: freebsd-arch , Pedro Giffuni Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 19:31:17 -0000 added pfg@ to CC On Mon, Oct 19, 2015 at 9:14 PM, NGie Cooper wrote: > Hi all, > While looking quickly through makefs upstream for fixing a PR, I = realized that some years ago NetBSD has refactored a number of userland uti= lities (including makefs) to use their new e* function implementations of m= alloc, strndup, etc: http://man.netbsd.org/HEAD/usr/share/man/html3/efun.ht= ml (they have some other functions that we don=E2=80=99t have in libc/libut= il in their libutil that might need to be ported as well). > The basic overall difference is that when the failing case occurs= , a function defined by esetfunc is called, it dumps out a diagnostic error= message via esetfunc, then returns the original value [*]. > I was wondering if anyone had objections to adding this to libuti= l (I think it=E2=80=99d be handy because it would eliminate a lot of repeti= tive error handling in our user land code)? If there are major objections, = I=E2=80=99ll take it and stuff it into libnetbsd. > Thanks! > -NGie > > [*] Based on a quick glance over the code, estrlcpy/estrlcat/estrtoi/estr= tou are exceptions to the rule. It modifies/saves errno before calling the = error function: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libutil/efun.c?= rev=3D1.10&content-type=3Dtext/x-cvsweb-markup&only_with_tag=3DMAIN > _______________________________________________ > freebsd-arch@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"