void *tp_cb; /* Optional tracepoint callback */
} __attribute__((aligned(8)));
-//ust// #ifdef CONFIG_MARKERS
+#define CONFIG_MARKERS
+#ifdef CONFIG_MARKERS
#define _DEFINE_MARKER(channel, name, tp_name_str, tp_cb, format) \
static const char __mstrtab_##channel##_##name[] \
#define GET_MARKER(channel, name) (__mark_##channel##_##name)
-//ust// #else /* !CONFIG_MARKERS */
-//ust// #define DEFINE_MARKER(channel, name, tp_name, tp_cb, format)
-//ust// #define __trace_mark(generic, channel, name, call_private, format, args...) \
-//ust// __mark_check_format(format, ## args)
-//ust// #define __trace_mark_tp(channel, name, call_private, tp_name, tp_cb, \
-//ust// format, args...) \
-//ust// do { \
-//ust// void __check_tp_type(void) \
-//ust// { \
-//ust// register_trace_##tp_name(tp_cb); \
-//ust// } \
-//ust// __mark_check_format(format, ## args); \
-//ust// } while (0)
-//ust// static inline void marker_update_probe_range(struct marker *begin,
-//ust// struct marker *end)
-//ust// { }
-//ust// #define GET_MARKER(channel, name)
-//ust// #endif /* CONFIG_MARKERS */
+#else /* !CONFIG_MARKERS */
+#define DEFINE_MARKER(channel, name, tp_name, tp_cb, format)
+#define __trace_mark(generic, channel, name, call_private, format, args...) \
+ __mark_check_format(format, ## args)
+#define __trace_mark_tp(channel, name, call_private, tp_name, tp_cb, \
+ format, args...) \
+ do { \
+ void __check_tp_type(void) \
+ { \
+ register_trace_##tp_name(tp_cb); \
+ } \
+ __mark_check_format(format, ## args); \
+ } while (0)
+static inline void marker_update_probe_range(struct marker *begin,
+ struct marker *end)
+{ }
+#define GET_MARKER(channel, name)
+#endif /* CONFIG_MARKERS */
/**
* trace_mark - Marker using code patching
struct list_head list;
};
-int marker_register_lib(struct marker *markers_start, int markers_count);
+extern int marker_register_lib(struct marker *markers_start,
+ int markers_count);
-#define MARKER_LIB \
-extern struct marker __start___markers[] __attribute__((visibility("hidden"))); \
+#define MARKER_LIB \
+extern struct marker __start___markers[] __attribute__((visibility("hidden"))); \
extern struct marker __stop___markers[] __attribute__((visibility("hidden"))); \
\
static void __attribute__((constructor)) __markers__init(void) \
result = ltt_chan->buf_shmid = shmget(getpid(), size, IPC_CREAT | IPC_EXCL | 0700);
if(ltt_chan->buf_shmid == -1) {
PERROR("shmget");
- return -1;
+ return;
}
ptr = shmat(ltt_chan->buf_shmid, NULL, 0);
result = shmctl(ltt_chan->buf_shmid, IPC_RMID, NULL);
if(result == -1) {
perror("shmctl");
- return -1;
+ return;
}
ltt_chan->buf = ptr;
- return 0;
+ return;
destroy_shmem:
result = shmctl(ltt_chan->buf_shmid, IPC_RMID, NULL);
perror("shmctl");
}
- return -1;
+ return;
}
/*
/* Out-of-order commit */
ltt_commit_slot(channel, &transport_data, buf_offset,
data_size, slot_size);
- printf("just commited event at offset %d and size %d\n", buf_offset, slot_size);
+ printf("just commited event at offset %ld and size %zd\n", buf_offset, slot_size);
}
//ust// __get_cpu_var(ltt_nesting)--;
ltt_nesting--;
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <signal.h>
}
}
-static int inform_consumer_daemon(void)
+static void inform_consumer_daemon(void)
{
ustcomm_request_consumer(getpid(), "metadata");
ustcomm_request_consumer(getpid(), "ust");
result = poll(fds, n_fds, 0);
if(result == -1) {
PERROR("poll");
- return -1;
+ return;
}
list_for_each_entry(bc, &blocked_consumers, list) {
}
-int listener_main(void *p)
+void *listener_main(void *p)
{
int result;
result = ltt_trace_setup(trace_name);
if(result < 0) {
ERR("ltt_trace_setup failed");
- return;
+ return (void *)1;
}
result = ltt_trace_set_type(trace_name, trace_type);
if(result < 0) {
ERR("ltt_trace_set_type failed");
- return;
+ return (void *)1;
}
result = ltt_trace_alloc(trace_name);
if(result < 0) {
ERR("ltt_trace_alloc failed");
- return;
+ return (void *)1;
}
inform_consumer_daemon();
result = ltt_trace_setup(trace_name);
if(result < 0) {
ERR("ltt_trace_setup failed");
- return;
+ return (void *)1;
}
result = ltt_trace_set_type(trace_name, trace_type);
if(result < 0) {
ERR("ltt_trace_set_type failed");
- return;
+ return (void *)1;
}
}
else if(!strcmp(recvbuf, "trace_alloc")) {
result = ltt_trace_alloc(trace_name);
if(result < 0) {
ERR("ltt_trace_alloc failed");
- return;
+ return (void *)1;
}
}
else if(!strcmp(recvbuf, "trace_start")) {
result = ltt_trace_stop(trace_name);
if(result < 0) {
ERR("ltt_trace_stop failed");
- return;
+ return (void *)1;
}
}
else if(!strcmp(recvbuf, "trace_destroy")) {
result = ltt_trace_destroy(trace_name);
if(result < 0) {
ERR("ltt_trace_destroy failed");
- return;
+ return (void *)1;
}
}
else if(nth_token_is(recvbuf, "get_shmid", 0) == 1) {
if(trace == NULL) {
CPRINTF("cannot find trace!");
- return 1;
+ return (void *)1;
}
for(i=0; i<trace->nr_channels; i++) {
if(trace == NULL) {
CPRINTF("cannot find trace!");
- return 1;
+ return (void *)1;
}
for(i=0; i<trace->nr_channels; i++) {
if(!strcmp(trace->channels[i].channel_name, channel_name)) {
char *reply;
- DBG("the n_subbufs for the requested channel is %d", rchan->n_subbufs);
- asprintf(&reply, "%d", rchan->n_subbufs);
+ DBG("the n_subbufs for the requested channel is %zd", rchan->n_subbufs);
+ asprintf(&reply, "%zd", rchan->n_subbufs);
result = ustcomm_send_reply(&ustcomm_app.server, reply, &src);
if(result) {
if(trace == NULL) {
CPRINTF("cannot find trace!");
- return 1;
+ return (void *)1;
}
for(i=0; i<trace->nr_channels; i++) {
if(!strcmp(trace->channels[i].channel_name, channel_name)) {
char *reply;
- DBG("the subbuf_size for the requested channel is %d", rchan->subbuf_size);
- asprintf(&reply, "%d", rchan->subbuf_size);
+ DBG("the subbuf_size for the requested channel is %zd", rchan->subbuf_size);
+ asprintf(&reply, "%zd", rchan->subbuf_size);
result = ustcomm_send_reply(&ustcomm_app.server, reply, &src);
if(result) {
if(trace == NULL) {
CPRINTF("cannot find trace!");
- return 1;
+ return (void *)1;
}
for(i=0; i<trace->nr_channels; i++) {
if(trace == NULL) {
CPRINTF("cannot find trace!");
- return 1;
+ return (void *)1;
}
for(i=0; i<trace->nr_channels; i++) {
result = ltt_do_put_subbuf(rbuf, lttbuf, consumed_old);
if(result < 0) {
WARN("ltt_do_put_subbuf: error (subbuf=%s)", channel_name);
- asprintf(&reply, "%s", "ERROR", consumed_old);
+ asprintf(&reply, "%s", "ERROR");
}
else {
DBG("ltt_do_put_subbuf: success (subbuf=%s)", channel_name);
- asprintf(&reply, "%s", "OK", consumed_old);
+ asprintf(&reply, "%s", "OK");
}
result = ustcomm_send_reply(&ustcomm_app.server, reply, &src);
//
// if(trace == NULL) {
// CPRINTF("cannot find trace!");
-// return 1;
+// return (void *)1;
// }
//
// for(i=0; i<trace->nr_channels; i++) {
//#include <linux/types.h>
//#include <linux/rcupdate.h>
-//#include "urcu.h"
+#define _LGPL_SOURCE
+#include <urcu.h>
+
#include "immediate.h"
#include "kernelcompat.h"
#define TPPROTO(args...) args
#define TPARGS(args...) args
-//ust// #ifdef CONFIG_TRACEPOINTS
+#define CONFIG_TRACEPOINTS
+#ifdef CONFIG_TRACEPOINTS
/*
* it_func[0] is never NULL because there is at least one element in the array
extern void tracepoint_update_probe_range(struct tracepoint *begin,
struct tracepoint *end);
-//ust// #else /* !CONFIG_TRACEPOINTS */
-//ust// #define DECLARE_TRACE(name, proto, args) \
-//ust// static inline void trace_##name(proto) \
-//ust// { } \
-//ust// static inline void _trace_##name(proto) \
-//ust// { } \
-//ust// static inline int register_trace_##name(void (*probe)(proto)) \
-//ust// { \
-//ust// return -ENOSYS; \
-//ust// } \
-//ust// static inline int unregister_trace_##name(void (*probe)(proto)) \
-//ust// { \
-//ust// return -ENOSYS; \
-//ust// }
-//ust//
-//ust// #define DEFINE_TRACE(name)
-//ust// #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
-//ust// #define EXPORT_TRACEPOINT_SYMBOL(name)
-//ust//
-//ust// static inline void tracepoint_update_probe_range(struct tracepoint *begin,
-//ust// struct tracepoint *end)
-//ust// { }
-//ust// #endif /* CONFIG_TRACEPOINTS */
+#else /* !CONFIG_TRACEPOINTS */
+#define DECLARE_TRACE(name, proto, args) \
+ static inline void trace_##name(proto) \
+ { } \
+ static inline void _trace_##name(proto) \
+ { } \
+ static inline int register_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline int unregister_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ }
+
+#define DEFINE_TRACE(name)
+#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
+#define EXPORT_TRACEPOINT_SYMBOL(name)
+
+static inline void tracepoint_update_probe_range(struct tracepoint *begin,
+ struct tracepoint *end)
+{ }
+#endif /* CONFIG_TRACEPOINTS */
/*
* Connect a probe to a tracepoint.
struct list_head list;
};
-#define TRACEPOINT_LIB \
-extern struct tracepoint __start___tracepoints[] __attribute__((visibility("hidden"))); \
-extern struct tracepoint __stop___tracepoints[] __attribute__((visibility("hidden"))); \
- \
-static void __attribute__((constructor)) __tracepoints__init(void) \
-{ \
- tracepoint_register_lib(__start___tracepoints, (((long)__stop___tracepoints)-((long)__start___tracepoints))/sizeof(struct tracepoint));\
-}
+extern int tracepoint_register_lib(struct tracepoint *tracepoints_start,
+ int tracepoints_count);
+
+#define TRACEPOINT_LIB \
+ extern struct tracepoint __start___tracepoints[] __attribute__((visibility("hidden"))); \
+ extern struct tracepoint __stop___tracepoints[] __attribute__((visibility("hidden"))); \
+ static void __attribute__((constructor)) __tracepoints__init(void) \
+ { \
+ tracepoint_register_lib(__start___tracepoints, \
+ (((long)__stop___tracepoints)-((long)__start___tracepoints))/sizeof(struct tracepoint)); \
+ }
+
#endif
+#define _GNU_SOURCE
+#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
-#include <stdio.h>
#include <fcntl.h>
#include "ustcomm.h"