From owner-cvs-src@FreeBSD.ORG Sun Jul 24 01:28:54 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 97A8216A41F; Sun, 24 Jul 2005 01:28:54 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6846B43D46; Sun, 24 Jul 2005 01:28:54 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j6O1Sssj063484; Sun, 24 Jul 2005 01:28:54 GMT (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j6O1SsP1063483; Sun, 24 Jul 2005 01:28:54 GMT (envelope-from rwatson) Message-Id: <200507240128.j6O1SsP1063483@repoman.freebsd.org> From: Robert Watson Date: Sun, 24 Jul 2005 01:28:54 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/libmemstat memstat.c memstat.h memstat_internal.h memstat_malloc.c memstat_uma.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2005 01:28:54 -0000 rwatson 2005-07-24 01:28:54 UTC FreeBSD src repository Modified files: lib/libmemstat memstat.c memstat.h memstat_internal.h memstat_malloc.c memstat_uma.c Log: Introduce more formal error handling for libmemstat(3): - Define a set of libmemstat(3) error constants, which are used by all libmemstat(3) methods except for memstat_mtl_alloc(), which allocates a memory type list and may return ENOMEM via errno. - Define a per-memory_type_list current error value, which is set when a call associated with a memory list fails. This requires wrapping a structure around the queue(9) list head data structure, but this change is not visible to libmemstat(3) consumers due to using access methods. - Add a new accessor method, memstat_mtl_geterror() to retrieve the error number. - Consistently set the error number in a number of failure modes where previously some combination of setting errno and printf'ing error descriptions was used. libmemstat(3) will now no longer print to stdio under any circumstances. Returns of NULL/-1 for errors remain the same. This avoids use of stdio, misuse of error numbers, and should make it easier to program a libmemstat(3) consumer able to print useful error messages. Currently, no error-to-string function is provided, as I'm unsure how to address internationalization concerns. MFC after: 1 day Revision Changes Path 1.4 +15 -6 src/lib/libmemstat/memstat.c 1.6 +15 -1 src/lib/libmemstat/memstat.h 1.5 +4 -1 src/lib/libmemstat/memstat_internal.h 1.4 +22 -29 src/lib/libmemstat/memstat_malloc.c 1.7 +22 -29 src/lib/libmemstat/memstat_uma.c