]> sourceware.org Git - systemtap.git/commitdiff
2006-09-22 Martin Hunt <hunt@redhat.com>
authorhunt <hunt>
Fri, 22 Sep 2006 16:37:51 +0000 (16:37 +0000)
committerhunt <hunt>
Fri, 22 Sep 2006 16:37:51 +0000 (16:37 +0000)
* print.c: Replace STP_PRINT_BUF_LEN with STP_BUFFER_SIZE.
* string.c: Ditto.

runtime/ChangeLog
runtime/print.c
runtime/string.c

index f981361663118ed221754f5f958f5e817e3c64c7..92db1160603fa4f3d2967b25e06aafa542ffc02e 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-22  Martin Hunt  <hunt@redhat.com>
+
+       * print.c: Replace STP_PRINT_BUF_LEN with STP_BUFFER_SIZE.
+       * string.c: Ditto.
+
 2006-09-21  Martin Hunt  <hunt@redhat.com>
        PR 3232
        * print.c (_stp_print_init): New. Alloc per-cpu buffers.
index 674bd4a020fb297dd1d19cad110e8893d4007905..904104f80bebc31d2f90a33f528ea27109d5b9e7 100644 (file)
 
 
 #define STP_PRINT_BUF_START (STP_TIMESTAMP_SIZE)
-#ifndef STP_PRINT_BUF_LEN
-#define STP_PRINT_BUF_LEN 8192
-#endif
 
 typedef struct __stp_pbuf {
        uint32_t len;                   /* bytes used in the buffer */
        char timestamp[STP_TIMESTAMP_SIZE];
-       char buf[STP_PRINT_BUF_LEN];
+       char buf[STP_BUFFER_SIZE];
 } _stp_pbuf;
 
 void *Stp_pbuf = NULL;
@@ -118,10 +115,10 @@ static void * _stp_reserve_bytes (int numbytes)
 static void * _stp_reserve_bytes (int numbytes)
 {
        _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
-       int size = STP_PRINT_BUF_LEN - pb->len;
+       int size = STP_BUFFER_SIZE - pb->len;
        void * ret;
 
-       if (unlikely(numbytes == 0 || numbytes > STP_PRINT_BUF_LEN))
+       if (unlikely(numbytes == 0 || numbytes > STP_BUFFER_SIZE))
                return NULL;
 
        if (numbytes > size)
index 4c92f591029872a639d4ef734a30b0d7d341bc20..6615d741e54bec745e9444d2ac2d696c832bfcc2 100644 (file)
@@ -60,7 +60,7 @@ void _stp_sprintf (String str, const char *fmt, ...)
        if (str == _stp_stdout) {
                _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
                char *buf = pb->buf + pb->len;
-               int size = STP_PRINT_BUF_LEN - pb->len;
+               int size = STP_BUFFER_SIZE - pb->len;
                va_start(args, fmt);
                num = _stp_vsnprintf(buf, size, fmt, args);
                va_end(args);
@@ -69,7 +69,7 @@ void _stp_sprintf (String str, const char *fmt, ...)
                        if (pb->len == 0) {
                                /* A single print request exceeded the buffer size. */
                                /* Should not be possible with Systemtap-generated code. */
-                               pb->len = STP_PRINT_BUF_LEN;
+                               pb->len = STP_BUFFER_SIZE;
                                _stp_print_flush();
                                num = 0;
                        } else {
@@ -78,7 +78,7 @@ void _stp_sprintf (String str, const char *fmt, ...)
 
                                /* try again */
                                va_start(args, fmt);
-                               num = _stp_vsnprintf(pb->buf, STP_PRINT_BUF_LEN, fmt, args);
+                               num = _stp_vsnprintf(pb->buf, STP_BUFFER_SIZE, fmt, args);
                                va_end(args);
                        }
                }
@@ -102,14 +102,14 @@ void _stp_vsprintf (String str, const char *fmt, va_list args)
        if (str == _stp_stdout) {
                _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
                char *buf = pb->buf + pb->len;
-               int size = STP_PRINT_BUF_LEN - pb->len;
+               int size = STP_BUFFER_SIZE - pb->len;
                num = _stp_vsnprintf(buf, size, fmt, 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_PRINT_BUF_LEN;
+                               pb->len = STP_BUFFER_SIZE;
                                _stp_print_flush();
                                num = 0;
                        } else {
@@ -117,7 +117,7 @@ void _stp_vsprintf (String str, const char *fmt, va_list args)
                                _stp_print_flush();
 
                                /* try again */
-                               num = _stp_vsnprintf(pb->buf, STP_PRINT_BUF_LEN, fmt, args);
+                               num = _stp_vsnprintf(pb->buf, STP_BUFFER_SIZE, fmt, args);
                        }
                }
                pb->len += num;
@@ -139,11 +139,11 @@ void _stp_string_cat_cstr (String str1, const char *str2)
        int num = strlen (str2);
        if (str1 == _stp_stdout) {
                _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
-               int size = STP_PRINT_BUF_LEN - pb->len;
+               int size = STP_BUFFER_SIZE - pb->len;
                if (num > size) {
                        _stp_print_flush();
-                       if (num > STP_PRINT_BUF_LEN)
-                               num = STP_PRINT_BUF_LEN;
+                       if (num > STP_BUFFER_SIZE)
+                               num = STP_BUFFER_SIZE;
                }
                memcpy (pb->buf + pb->len, str2, num);
                pb->len += num;
@@ -174,7 +174,7 @@ void _stp_string_cat_char (String str1, const char c)
 {
        if (str1 == _stp_stdout) {
                _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
-               int size = STP_PRINT_BUF_LEN - pb->len;
+               int size = STP_BUFFER_SIZE - pb->len;
                char *buf;
 
                if (1 >= size)
This page took 0.041146 seconds and 5 git commands to generate.