From: compudj Date: Thu, 9 Mar 2006 18:32:11 +0000 (+0000) Subject: ut fast : use sigsuspend to be signal safe X-Git-Tag: v0.12.20~1860 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7076f16d0a1f74bd559f6793d60a1647a56c968e;p=lttv.git ut fast : use sigsuspend to be signal safe git-svn-id: http://ltt.polymtl.ca/svn@1629 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/usertrace-fast/Makefile b/usertrace-fast/Makefile index d63a9648..7430a3b4 100644 --- a/usertrace-fast/Makefile +++ b/usertrace-fast/Makefile @@ -7,7 +7,7 @@ RANLIB=ranlib CC=gcc CFLAGS=-I. -O3 #CFLAGS+=-DLTT_SUBBUF_SIZE_CPU=134217728 -#CFLAGS+=-DLTT_NULL_OUTPUT_TEST +CFLAGS+=-DLTT_NULL_OUTPUT_TEST all: test sample-instrument-fct libltt-instrument-functions.a libltt-instrument-functions.so.0 sample-loop diff --git a/usertrace-fast/ltt-usertrace-fast.c b/usertrace-fast/ltt-usertrace-fast.c index edc37b85..0443a10b 100644 --- a/usertrace-fast/ltt-usertrace-fast.c +++ b/usertrace-fast/ltt-usertrace-fast.c @@ -375,6 +375,7 @@ get_error: static void ltt_usertrace_fast_daemon(struct ltt_trace_info *shared_trace_info, sigset_t oldset, pid_t l_traced_pid, pthread_t l_traced_tid) { + sigset_t set; struct sigaction act; int ret; int fd_process; @@ -406,12 +407,6 @@ static void ltt_usertrace_fast_daemon(struct ltt_trace_info *shared_trace_info, sigaddset(&(act.sa_mask), SIGALRM); sigaction(SIGALRM, &act, NULL); - /* Enable signals */ - ret = pthread_sigmask(SIG_SETMASK, &oldset, NULL); - if(ret) { - dbg_printf("LTT Error in pthread_sigmask\n"); - } - alarm(3); /* Open output files */ @@ -444,11 +439,15 @@ static void ltt_usertrace_fast_daemon(struct ltt_trace_info *shared_trace_info, #endif //LTT_NULL_OUTPUT_TEST while(1) { - pause(); + ret = sigsuspend(&oldset); + if(ret) { + perror("LTT Error in sigsuspend\n"); + } + if(traced_pid == 0) break; /* parent died */ if(parent_exited) break; dbg_printf("LTT Doing a buffer switch read. pid is : %lu\n", getpid()); - + do { ret = read_subbuffer(&shared_trace_info->channel.process, fd_process); } while(ret == 0);