From owner-freebsd-arch@freebsd.org Mon Oct 19 19:14:36 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 E1FEFA195B5 for ; Mon, 19 Oct 2015 19:14:36 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (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 B63B232B for ; Mon, 19 Oct 2015 19:14:36 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by padhk11 with SMTP id hk11so37766796pad.1 for ; Mon, 19 Oct 2015 12:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=G5+e5GyiZjRlRMQYU+9FEA/mDGBXrHN91Es7RC4pqbs=; b=U6+0I9cx17at+o8c+ErUayG7PMGo5VJps1ZHrEkLv8Sr9oZxhqCuDVgg2ire9Ju/g8 gDM81ma/nZ9XoUHbN17QBrQw2MrCI06K8hyyx3RBRLhnRpSAlZqMhZ0RfbvKGtbN9QRM 89Z/gvlOLJQcADgoa0PZZ6ioQIM5aCHJN8V8Su29fkgZHCJ6OoalO/NTwX//GCmmH7e5 9gTvVVQ+ELwjXcD4ql3RoZQn5MBSzZ2t4PZojT+4MBGPSP15nuFvrFttAgUzfC0T6Q2C kPD/aFs3aDNmvJ9c4PJehXh/TM9VDvcPQOCJFX4LNfurgrY1E2Gn1qlh/unvOK8hil8q sYlA== X-Received: by 10.66.147.74 with SMTP id ti10mr36620353pab.88.1445282076314; Mon, 19 Oct 2015 12:14:36 -0700 (PDT) Received: from ?IPv6:2601:601:800:126d:957b:6ba6:5bab:7c49? ([2601:601:800:126d:957b:6ba6:5bab:7c49]) by smtp.gmail.com with ESMTPSA id rc5sm37637266pbc.95.2015.10.19.12.14.35 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Oct 2015 12:14:35 -0700 (PDT) From: NGie Cooper Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: [RFC] importing e* (embolic, estrdup, etc) functions from NetBSD (libc/libutil or libnetbsd)? Message-Id: <74F6DD3C-42F6-490B-A08E-245A1338A3E7@gmail.com> Date: Mon, 19 Oct 2015 12:14:34 -0700 To: freebsd-arch Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) X-Mailer: Apple Mail (2.2104) 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:14:37 -0000 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 = utilities (including makefs) to use their new e* function = implementations of malloc, strndup, etc: = http://man.netbsd.org/HEAD/usr/share/man/html3/efun.html (they have some = other functions that we don=E2=80=99t have in libc/libutil 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 = libutil (I think it=E2=80=99d be handy because it would eliminate a lot = of repetitive 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/estrtou 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&cont= ent-type=3Dtext/x-cvsweb-markup&only_with_tag=3DMAIN=