cvs commit: src/lib/libmemstat memstat.c memstat.h
memstat_internal.h memstat_malloc.c memstat_uma.c
Robert Watson
rwatson at FreeBSD.org
Sun Jul 24 01:28:54 GMT 2005
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
More information about the cvs-src
mailing list