summaryrefslogtreecommitdiffstats
path: root/runtime/print.c
diff options
context:
space:
mode:
authorKent Sebastian <ksebasti@redhat.com>2009-04-17 12:03:09 -0400
committerKent Sebastian <ksebasti@redhat.com>2009-04-17 12:03:09 -0400
commit9831040e54178a1b6eb4637213bb3c81f6ed254b (patch)
treef89778fcc253266b8d473ee0569bef8d606de6d9 /runtime/print.c
parentbe8770ce0c66eea1113c3c91682b4fdf6ae1ec77 (diff)
downloadsystemtap-steved-9831040e54178a1b6eb4637213bb3c81f6ed254b.tar.gz
systemtap-steved-9831040e54178a1b6eb4637213bb3c81f6ed254b.tar.xz
systemtap-steved-9831040e54178a1b6eb4637213bb3c81f6ed254b.zip
PR7072: use _stp_reserve_bytes for printf buffer
Diffstat (limited to 'runtime/print.c')
-rw-r--r--runtime/print.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/runtime/print.c b/runtime/print.c
index 2c84d3c9..964a73c2 100644
--- a/runtime/print.c
+++ b/runtime/print.c
@@ -13,8 +13,8 @@
#include "string.h"
-#include "vsprintf.c"
#include "transport/transport.c"
+#include "vsprintf.c"
/** @file print.c
* Printing Functions.
@@ -173,34 +173,10 @@ static void _stp_print_binary (int num, ...)
*/
static void _stp_printf (const char *fmt, ...)
{
- int num;
va_list args;
- _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
- char *buf = pb->buf + pb->len;
- int size = STP_BUFFER_SIZE - pb->len;
-
va_start(args, fmt);
- num = _stp_vsnprintf(buf, size, fmt, args);
+ _stp_vsnprintf(NULL, 0, fmt, args);
va_end(args);
- if (unlikely(num >= size)) {
- /* overflowed the buffer */
- if (pb->len == 0) {
- /* A single print request exceeded the buffer size. */
- /* Should not be possible with Systemtap-generated code. */
- pb->len = STP_BUFFER_SIZE;
- _stp_print_flush();
- num = 0;
- } else {
- /* Need more space. Flush the previous contents */
- _stp_print_flush();
-
- /* try again */
- va_start(args, fmt);
- num = _stp_vsnprintf(pb->buf, STP_BUFFER_SIZE, fmt, args);
- va_end(args);
- }
- }
- pb->len += num;
}
/** Write a string into the print buffer.