Subject: %b -> bitmask_snprintf()
To: None <current-users@NetBSD.ORG>
From: Jason Thorpe <firstname.lastname@example.org>
Date: 11/12/1996 23:02:42
Just a heads-up...
I've implemented a bitmask_snprintf() function that is designed to
replace the functionality of the kernel `%b' printf() format. Once
all of the occurrences of `%b' are eliminated, support for that
format will be removed from the kernel printf().
bitmask_snprintf() is pretty simple.. you pass it the value and
bit string (like `%b'), and a buffer and the size of that buffer (for
reentrancy). It returns a pointer to the beginning of the buffer
so that it can be nested inside a printf() call. Be careful when
nesting several bitmask_snprintf()s inside one call to printf(); if
you use the same buffer for all of them, you'll see the string for
the last call for all calls nested in that printf() (this should be
obvious, but I thought I'd mention it anyhow :-). The best thing
to do in those situations is to split up the printf() into several
so that you don't gratuitously waste stack space.
Removing the non-standard formats (currently `%b' and `%:') brings
us closer to having a kernel printf() that behaves just like the
userland printf(). This is a Good Thing(tm).
I haven't quite changed all of them yet, but I'm going to try and hit
the last of them tomorrow. There are a fair number of `%b' occurrences,
and obviously I can't test-compile all of them, so if I made any mistakes,
please let me know, and I or someone else will correct them ASAP.
Jason R. Thorpe email@example.com
NASA Ames Research Center Home: 408.866.1912
NAS: M/S 258-6 Work: 415.604.0935
Moffett Field, CA 94035 Pager: 415.428.6939