X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=usertrace-fast%2Fltt%2Fltt-usertrace-fast.h;h=318eff6a0df7f29730addd11669cb2437e5c02e9;hb=85b943204bb971fac3e1f0c52f304acbbc44641b;hp=77e0594ff58045c5c8fdb817c1656e95e74558d7;hpb=1220c1988b9360b10c04934a3abe4ca30f24cbb1;p=lttv.git diff --git a/usertrace-fast/ltt/ltt-usertrace-fast.h b/usertrace-fast/ltt/ltt-usertrace-fast.h index 77e0594f..318eff6a 100644 --- a/usertrace-fast/ltt/ltt-usertrace-fast.h +++ b/usertrace-fast/ltt/ltt-usertrace-fast.h @@ -15,20 +15,12 @@ #include #include #include -#include #include +#include #include #include -#ifndef futex -static inline __attribute__((no_instrument_function)) - _syscall6(long, futex, unsigned long, uaddr, int, op, int, val, - unsigned long, timeout, unsigned long, uaddr2, int, val2) -#endif //futex - - - #ifndef LTT_N_SUBBUFS #define LTT_N_SUBBUFS 2 #endif //LTT_N_SUBBUFS @@ -112,7 +104,7 @@ struct ltt_buf { atomic_t events_lost; atomic_t corrupted_subbuffers; - atomic_t writer_futex; /* futex on which the writer waits */ + sem_t writer_sem; /* semaphore on which the writer waits */ unsigned int alloc_size; unsigned int subbuf_size; }; @@ -418,19 +410,7 @@ static inline void * __attribute__((no_instrument_function)) ltt_reserve_slot( //if((SUBBUF_TRUNC(offset_begin, ltt_buf) // - SUBBUF_TRUNC(atomic_read(<t_buf->consumed), ltt_buf)) // >= ltt_buf->alloc_size) { - if(atomic_dec_return(<t_buf->writer_futex) >= 0) { - /* non contended */ - } else { - /* We block until the reader unblocks us */ - atomic_set(<t_buf->writer_futex, -1); - /* We block until the reader tells us to wake up. - Signals will simply cause this loop to restart. - */ - do { - ret = futex((unsigned long)<t_buf->writer_futex, - FUTEX_WAIT, -1, 0, 0, 0); - } while(ret != 0 && ret != EWOULDBLOCK); - } + sem_wait(<t_buf->writer_sem); /* go on with the write */ //} else { @@ -440,6 +420,7 @@ static inline void * __attribute__((no_instrument_function)) ltt_reserve_slot( } else { /* Next subbuffer corrupted. Force pushing reader even in normal * mode. It's safe to write in this new subbuffer. */ + sem_post(<t_buf->writer_sem); } size = ltt_get_header_size(trace, ltt_buf->start + offset_begin, before_hdr_pad, after_hdr_pad, header_size) + data_size;