[Devel] Feature request: error/debug message extension.
zanga.mail at gmail.com
Sun Jan 15 13:36:55 PST 2012
2012/1/15 Gabriel M. Beddingfield <gabrbedd at gmail.com>:
> From the very start, I've been fine with something like this:
> format_string(s, BUFSIZE, "number = ?", (double)3);
> ...and if you want more control over the formatting then you need to bring
> your own. This sort of thing is very easy to implement RT-safe.
> I'm *not* fine with requiring hosts to support something like this:
> snprintf(s, BUFSIZE, "number = \\%-08.3g%%", (double)3);
> ...UNLESS there is an RT-safe implementation of snprintf() available
> somewhere. (I'm even OK if the implementation actually ignores everything
> except the type that's given.)
If you want you can have fun with this
It's an (v)asprintf() implementation that only uses standard C stuff
and only performs the one necessary allocation (the output buffer, and
the size is exactly the needed size unlike glibc's asprintf()) - i.e.,
this can be easily turned into an RT-safe snprintf().
However I don't think producing log/debug messages from RT threads is
such a great idea in any case.
More information about the Devel