[RFC] importing e* (embolic, estrdup, etc) functions from NetBSD (libc/libutil or libnetbsd)?

NGie Cooper yaneurabeya at gmail.com
Mon Oct 19 19:14:37 UTC 2015


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’t 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’d be handy because it would eliminate a lot of repetitive error handling in our user land code)? If there are major objections, I’ll 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=1.10&content-type=text/x-cvsweb-markup&only_with_tag=MAIN


More information about the freebsd-arch mailing list