UST-wide warning fixes/bugfixes
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 10 Feb 2011 18:36:54 +0000 (13:36 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 10 Feb 2011 18:36:54 +0000 (13:36 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
15 files changed:
configure.ac
include/ust/ust_trace.h
libust-initializer.c
libust/buffers.c
libust/buffers.h
libust/marker.c
libust/tracectl.c
libustcomm/ustcomm.c
libustconsumer/libustconsumer.c
libustconsumer/lowlevel.c
tests/libustctl_function_tests/libustctl_function_tests.c
tests/register_test/register_test.c
tests/tap.c
tests/trace_event/trace_event_test.c
ust-consumerd/ust-consumerd.c

index 2b2962a5e1891231effe8c83e9249f28e9a0c061..e57b3562fe3beb355eb650eafae2a2b4d54c5507 100644 (file)
@@ -52,6 +52,8 @@ AC_C_INLINE
 AC_FUNC_MALLOC
 AC_CHECK_FUNCS([gettimeofday munmap socket strerror strtol])
 
+CFLAGS="-Wall $CFLAGS"
+
 # URCU
 
 # urcu - check if we just find the headers it out of the box.
index cedd47fdf5ab8bec5a5038dee3b6f998bd677a66..11d5940c68bed8ae85d1bb9b1f593fd8df9156d3 100644 (file)
@@ -84,7 +84,7 @@
        };                                                              \
        static void __attribute__((constructor)) init_##name()          \
        {                                                               \
-               void *dummy;                                            \
+               void *dummy = NULL;                                     \
                register_trace_##name(trace_printf_##name, dummy);      \
        }
 
index 2ac56375a32d90ecc2b1463070db49945bd7a7e3..a7103389bf3f7611236c3ab94537b5aaf52cbdee 100644 (file)
@@ -26,10 +26,9 @@ DEFINE_TRACE(ust_dummytp);
 
 void dummy_libust_initializer_func(void)
 {
-       int i;
        trace_mark(ust, dummymark, MARK_NOARGS);
-       trace_ust_dummytp(i);
-       trace_ust_dummy_event(i);
+       trace_ust_dummytp(0);
+       trace_ust_dummy_event(0);
 }
 
 MARKER_LIB;
index e5a1db3962e542e44be1f43453579328a4dc3bad..2e6a16181c25ceea46a8ba031eaa87037dfb6352 100644 (file)
@@ -655,6 +655,7 @@ static int unmap_buf_structs(struct ust_channel *chan)
                        PERROR("shmdt");
                }
        }
+       return 0;
 }
 
 /*
index eb75c8b698db4840f5269071f1219fcdf3d60cb8..ddacdffe68ac5c1c4ae0745b4f31b15f773cdeba 100644 (file)
@@ -26,6 +26,7 @@
 #include <assert.h>
 
 #include <ust/core.h>
+#include <ust/clock.h>
 
 #include "usterr.h"
 #include "channels.h"
index 2618b1aea1efea88c67d8b424b0c866b046e9be6..7a32351bd59d1e2038d3a77613f6ce6a1edfb8db 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <ust/core.h>
 #include <ust/marker.h>
+#include <ust/tracepoint.h>
 
 #include "usterr.h"
 #include "channels.h"
index e877e6289f7ef0e32ca88c6ab595f7117a81298b..25fa4d57ecde33954791d2bca5a21a4639af9a2d 100644 (file)
@@ -355,7 +355,7 @@ static int set_subbuf_size(const char *trace_name, const char *ch_name,
        }
 
        channel->subbuf_size = power;
-       DBG("the set_subbuf_size for the requested channel is %u", channel->subbuf_size);
+       DBG("the set_subbuf_size for the requested channel is %zu", channel->subbuf_size);
 
 unlock_traces:
        ltt_unlock_traces();
@@ -393,7 +393,7 @@ static int set_subbuf_num(const char *trace_name, const char *ch_name,
        }
 
        channel->subbuf_cnt = num;
-       DBG("the set_subbuf_cnt for the requested channel is %zd", channel->subbuf_cnt);
+       DBG("the set_subbuf_cnt for the requested channel is %u", channel->subbuf_cnt);
 
 unlock_traces:
        ltt_unlock_traces();
index 9b1d83a9a4d86bde829f45830b404872a7fe8e1c..43f4289a58662cca985fcbc68d26b2f7c49bd7ee 100644 (file)
@@ -371,7 +371,7 @@ int ustcomm_recv_fd(int sock,
        if (peek_header.size && data) {
                if (peek_header.size < 0 ||
                    peek_header.size > USTCOMM_DATA_SIZE) {
-                       ERR("big peek header! %d", peek_header.size);
+                       ERR("big peek header! %ld", peek_header.size);
                        return 0;
                }
 
index 6cb3dbf3b472327c65b1a8363d552a23c6b042ec..739a22235198c2cc67668c029738c3baf41ac542 100644 (file)
@@ -487,6 +487,7 @@ int consumer_loop(struct ustconsumer_instance *instance, struct buffer_info *buf
                        /* Skip the first subbuffer. We are not sure it is trustable
                         * because the put_subbuffer() did not complete.
                         */
+                       /* TODO: check on_put_error return value */
                        if(instance->callbacks->on_put_error)
                                instance->callbacks->on_put_error(instance->callbacks, buf);
 
@@ -598,7 +599,7 @@ int start_consuming_buffer(struct ustconsumer_instance *instance, pid_t pid,
        args->channel_cpu = channel_cpu;
        args->instance = instance;
        DBG("beginning2 of start_consuming_buffer: args: pid %d trace %s"
-           " bufname %s_%d", args->pid, args->channel, args->channel_cpu);
+           " bufname %s_%d", args->pid, args->trace, args->channel, args->channel_cpu);
 
        result = pthread_create(&thr, NULL, consumer_thread, args);
        if(result == -1) {
@@ -611,7 +612,7 @@ int start_consuming_buffer(struct ustconsumer_instance *instance, pid_t pid,
                return -1;
        }
        DBG("end of start_consuming_buffer: args: pid %d trace %s "
-           "bufname %s_%d", args->pid, args->channel, args->channel_cpu);
+           "bufname %s_%d", args->pid, args->channel, args->trace, args->channel_cpu);
 
        return 0;
 }
index 7eb124b98d75263c6aef91e1b0ee98ac8c928bcc..730dd110f9d0eb0760eedc76c4cec84dc50edaf6 100644 (file)
@@ -118,7 +118,7 @@ void finish_consuming_dead_subbuffer(struct ustconsumer_callbacks *callbacks, st
                        /* If it was, we only check the data_size. This is the amount of valid data at
                         * the beginning of the subbuffer. */
                        valid_length = header->data_size;
-                       DBG("writing full subbuffer (%d) with valid_length = %ld", i_subbuf, valid_length);
+                       DBG("writing full subbuffer (%ld) with valid_length = %ld", i_subbuf, valid_length);
                }
                else {
                        /* If the subbuffer was not fully written, then we don't check data_size because
@@ -127,12 +127,13 @@ void finish_consuming_dead_subbuffer(struct ustconsumer_callbacks *callbacks, st
                         */
 
                        valid_length = commit_seq & (buf->subbuf_size-1);
-                       DBG("writing unfull subbuffer (%d) with valid_length = %ld", i_subbuf, valid_length);
+                       DBG("writing unfull subbuffer (%ld) with valid_length = %ld", i_subbuf, valid_length);
                        header->data_size = valid_length;
                        header->sb_size = PAGE_ALIGN(valid_length);
                        assert(i_subbuf == (last_subbuf % buf->n_subbufs));
                }
 
+               /* TODO: check on_read_partial_subbuffer return value */
                if(callbacks->on_read_partial_subbuffer)
                        callbacks->on_read_partial_subbuffer(callbacks, buf, i_subbuf, valid_length);
 
index 784ff5d01b4646b3f049c1952f5d2d492fc2c42e..947028f960cc0527cfbbb203282b93a1d6e6eb9d 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 
 #include <ust/marker.h>
 #include <ust/ustctl.h>
@@ -155,12 +156,10 @@ static void ustctl_function_tests(pid_t pid)
 
 }
 
-
-int main()
+int main(int argc, char **argv)
 {
-       int i, status, pipefd[2];
+       int i, status;
        pid_t parent_pid, child_pid;
-       FILE *pipe_file;
 
        tap_plan(27);
 
index 90fca12edf99f3ceba67f5e82ee22aa07774079f..b593185e707f8d4c0f1cef55110f8453cda820b5 100644 (file)
@@ -79,10 +79,11 @@ static void * register_thread_main(void *data)
                }
                printf("Unregistered all\n");
        }
+       return NULL;
 }
 
 
-int main()
+int main(int argc, char **argv)
 {
        pthread_t register_thread;
        int i;
index 940cc1ae4aefc6c44528ba37bc68b09f6dcd6096..bd7f81cc1eeeb61f455e8c756610e04b0a6d9acb 100644 (file)
@@ -18,6 +18,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <string.h>
 
 static int tap_planned = -1;
 static int tap_count = 1;
index 9ed3d6ce0433486ec5182ec1399c69e6bbd27137..f4fa90a8de9e1218704e9671b33d2258d9a8d2d9 100644 (file)
@@ -27,4 +27,5 @@ int main(int argc, char * argv[])
                time=trace_clock_read64();
                trace_test(time, i);
        }
+       return 0;
 }
index fae4efafa87f06e02c80ef09080a0b2e8afabaf0..ce2ee40a339a96b05e880c7355af1a2e63a2f2f6 100644 (file)
@@ -33,6 +33,7 @@
 #include <getopt.h>
 
 #include "ust/ustconsumer.h"
+#include "../libustconsumer/lowlevel.h"
 #include "usterr.h"
 
 char *sock_path=NULL;
@@ -144,7 +145,7 @@ int on_read_partial_subbuffer(struct ustconsumer_callbacks *data, struct buffer_
        result = patient_write(buf_local->file_fd, buf->mem + subbuf_index * buf->subbuf_size, valid_length);
        if(result == -1) {
                ERR("Error writing to buffer file");
-               return;
+               return result;
        }
 
        /* pad with empty bytes */
@@ -154,11 +155,11 @@ int on_read_partial_subbuffer(struct ustconsumer_callbacks *data, struct buffer_
                result = patient_write(buf_local->file_fd, tmp, pad_size);
                if(result == -1) {
                        ERR("Error writing to buffer file");
-                       return;
+                       return result;
                }
                free(tmp);
        }
-
+       return result;
 }
 
 int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf)
@@ -234,7 +235,7 @@ int on_close_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf)
 
 int on_put_error(struct ustconsumer_callbacks *data, struct buffer_info *buf)
 {
-       unwrite_last_subbuffer(buf);
+       return unwrite_last_subbuffer(buf);
 }
 
 struct ustconsumer_callbacks *new_callbacks()
This page took 0.032981 seconds and 4 git commands to generate.