* It can also happen if this is a buffer we never got. */
return -EIO;
} else {
+ if(traced_pid == 0 || parent_exited) return 0;
+
ret = sem_post(<t_buf->writer_sem);
if(ret < 0) {
printf("error in sem_post");
{
struct sigaction act;
int ret;
- int fd_process;
+ int fd_process = -1;
char outfile_name[PATH_MAX];
char identifier_name[PATH_MAX];
if(ret != -1) {
perror("LTT Error in sigsuspend\n");
}
- if((traced_pid == 0) || parent_exited) goto dead_parent;
#ifndef LTT_NULL_OUTPUT_TEST
fd_process = creat(outfile_name, 0644);
perror("LTT Error in sigsuspend\n");
}
}
-dead_parent:
/* The parent thread is dead and we have finished with the buffer */
/* Buffer force switch (flush). Using FLUSH instead of ACTIVE because we know
ret = read_subbuffer(&shared_trace_info->channel.process, fd_process);
} while(ret == 0);
-
- close(fd_process);
+ if(fd_process != -1)
+ close(fd_process);
ret = sem_destroy(&shared_trace_info->channel.process.writer_sem);
if(ret < 0) {
printf("Abort with CTRL-C or it will quickly fill up your disk.\n");
printf("See the result file in /tmp/ltt-usertrace.\n");
- while(1) {
+ int i;
+ //while(1) {
+ for(i=0; i<100000; i++) {
trace_user_generic_string("Running fast!");
}
printf("thread 1, thread id : %lu, pid %lu\n", pthread_self(), getpid());
for(i=0; i<100000; i++) {
- trace_user_generic_string("Hello world! Have a nice day.");
+// trace_user_generic_string("Hello world! Have a nice day.");
}
pthread_exit((void*)1);
}
printf("thread 2, thread id : %lu, pid %lu\n", pthread_self(), getpid());
for(i=0; i<100000; i++) {
-// trace_user_generic_string("Hello world! Have a nice day.");
+ trace_user_generic_string("Hello world! Have a nice day.");
}
/* This thread is a bad citizen : returning like this will cause its cancel
* routines not to be executed. This is still detected by the tracer, but only