Use them to `make gcc -Wformat' check formats for all printf-like
and scanf-like functions in /usr/src except for the err()/warn()
family. err() isn't quite printf-like since its format arg can
legitimately be NULL. syslog() isn't quite printf-like, but gcc
already accepts %m, even for plain printf() when it shouldn't.
as threatened in the 4-5 year old comment. Most of the change is
in <machine/ansi.h>; this commit just removes cruft for the strict
ANSI case. 64-bit types couldn't actually be defined using
__attribute__(()) in gcc-2.4, since attribute names in the
implementation namespace only became available in gcc-2.7. I've
probably just broken gcc-2.6 support by using the gcc-2.7 names
unconditionally.
about spaces and tabs.
The externs in the static inline functions remain 'cause (a) they're
required; and (b) I can't find any gcc -W* cases where they generate
warnings.
test for __isthreaded before calling the lock/unlock functions to
try to save some performance. The _THREAD_SAFE case should become the
default, but since it tests for a global variable in libc, people won't
be able to build -current on pre-3.0 systems unless the default leaves
it out. Such is life.
Use _BSD_OFF_T_ instead of off_t so that we're still self-sufficent.
Copied the ftruncate/lseek()/mmap()/truncate() redeclaration hacks
from <sys/types.h> so that things depending on them don't break.
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.
not based on gpl'ed code, just prototype and usage. I'm not 100% certain
they behave the same while the system is in trouble (eg: malloc() failing)
but in those circumstances all bets would be off anyway.
These routines work like sprintf() and vsprintf(), except that instead of
using a fixed buffer, they allocate memory and return it to the user
and it's the user's responsibility to free() it. They have allocate as
much memory as they need (and can get), so the size of strings it can deal
with is limited only by the amount of memory it can malloc() on your
behalf.
There are a few gpl'ed programs starting to use this interface, and it's
becoming more common with the scares about security risks with sprintf().
I dont like the look of the code that the various programs (including
cvs, gdb, libg++, etc) provide if configure can't find it on the system.
It should be possible to modify the stdio core code to provide this
interface more efficiently, I was more worried about having something
that worked and was secure. :-) (I noticed that there was once intended
to be a smprintf() routine when our stdio was written for 4.4BSD, but it
looks pretty stillborn, and it's intended interface is not clear). Since
Linux and gnu libc have this interface, it seemed silly to bring yet
another one onto the scene.