From b5d612cbaca013b84531e78e43c97c6566346d08 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 8 Mar 2006 19:23:25 +0000 Subject: [PATCH] it runs git-svn-id: http://ltt.polymtl.ca/svn@1620 04897980-b3bd-0310-b5e0-8ef037075253 --- usertrace-fast/Makefile | 12 ++++++++---- usertrace-fast/ltt-instrument-functions.c | 2 +- usertrace-fast/ltt-usertrace-fast.c | 7 ++++++- usertrace-fast/{ => ltt}/ltt-usertrace-fast.h | 3 ++- usertrace-fast/test.c | 2 +- 5 files changed, 18 insertions(+), 8 deletions(-) rename usertrace-fast/{ => ltt}/ltt-usertrace-fast.h (99%) diff --git a/usertrace-fast/Makefile b/usertrace-fast/Makefile index ced8f6fb..a154f886 100644 --- a/usertrace-fast/Makefile +++ b/usertrace-fast/Makefile @@ -1,25 +1,29 @@ +LIB_DIR=/usr/lib +INCLUDE_DIR=/usr/include + RANLIB=ranlib CC=gcc +CFLAGS=-I. -g all: test sample-instrument-fct libltt-instrument-functions.a libltt-instrument-functions.so.0 test: test.c ltt-usertrace-fast.c - $(CC) $(CFLAGS) -lpthread -o $@ $^ + $(CC) $(CFLAGS) -I. -lpthread -o $@ $^ sample-instrument-fct: sample-instrument-fct.c $(CC) $(CFLAGS) -L. -g -finstrument-functions -lltt-instrument-functions -o $@ $^ -libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o +libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o @rm -f libltt-instrument-functions.a $(AR) rc $@ $^ $(RANLIB) $@ -libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o +libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0 - $(CC) $(CFLAGS) -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^ + $(CC) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^ ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so install: diff --git a/usertrace-fast/ltt-instrument-functions.c b/usertrace-fast/ltt-instrument-functions.c index 28c7c8e1..ed53c105 100644 --- a/usertrace-fast/ltt-instrument-functions.c +++ b/usertrace-fast/ltt-instrument-functions.c @@ -7,7 +7,7 @@ #define LTT_TRACE #define LTT_TRACE_FAST -#include "ltt-usertrace-fast.h" +#include #include void __attribute__((no_instrument_function)) __cyg_profile_func_enter ( diff --git a/usertrace-fast/ltt-usertrace-fast.c b/usertrace-fast/ltt-usertrace-fast.c index 55ba880a..d3f9333d 100644 --- a/usertrace-fast/ltt-usertrace-fast.c +++ b/usertrace-fast/ltt-usertrace-fast.c @@ -68,7 +68,7 @@ _syscall0(pid_t,gettid) -#include "ltt-usertrace-fast.h" +#include enum force_switch_mode { FORCE_ACTIVE, FORCE_FLUSH }; @@ -533,8 +533,13 @@ void ltt_rw_init(void) printf("LTT Error in pthread_sigmask\n"); } } else if(pid == 0) { + pid_t sid; /* Child */ role = LTT_ROLE_READER; + sid = setsid(); + if(sid < 0) { + perror("Error setting sid"); + } ltt_usertrace_fast_daemon(shared_trace_info, oldset, l_traced_pid, l_traced_tid); /* Should never return */ diff --git a/usertrace-fast/ltt-usertrace-fast.h b/usertrace-fast/ltt/ltt-usertrace-fast.h similarity index 99% rename from usertrace-fast/ltt-usertrace-fast.h rename to usertrace-fast/ltt/ltt-usertrace-fast.h index e4930d73..a175d895 100644 --- a/usertrace-fast/ltt-usertrace-fast.h +++ b/usertrace-fast/ltt/ltt-usertrace-fast.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -178,7 +179,7 @@ static inline struct ltt_buf * __attribute__((no_instrument_function)) ltt_get_channel_from_index( struct ltt_trace_info *trace, unsigned int index) { - return *(struct ltt_buf **)((void*)trace+index); + return (struct ltt_buf *)((void*)trace+index); } diff --git a/usertrace-fast/test.c b/usertrace-fast/test.c index 8ac69eb5..4960c0bc 100644 --- a/usertrace-fast/test.c +++ b/usertrace-fast/test.c @@ -4,7 +4,7 @@ #include #include -#include "ltt-usertrace-fast.h" +#include -- 2.34.1