| 1 | |
| 2 | /* LTTng user-space tracing header |
| 3 | * |
| 4 | * Copyright 2006 Mathieu Desnoyers |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef _LTTNG_USERTRACE_H |
| 9 | #define _LTTNG_USERTRACE_H |
| 10 | |
| 11 | #include <errno.h> |
| 12 | #include <syscall.h> |
| 13 | |
| 14 | #include <asm/atomic.h> |
| 15 | |
| 16 | //Put in asm-i486/unistd.h |
| 17 | #define __NR_ltt_update 294 |
| 18 | #define __NR_ltt_switch 295 |
| 19 | |
| 20 | #undef NR_syscalls |
| 21 | #define NR_syscalls 296 |
| 22 | |
| 23 | #ifndef _LIBC |
| 24 | // Put in bits/syscall.h |
| 25 | #define SYS_ltt_update __NR_ltt_update |
| 26 | #define SYS_ltt_switch __NR_ltt_switch |
| 27 | #endif |
| 28 | |
| 29 | struct ltt_buf { |
| 30 | void *start; |
| 31 | size_t length; |
| 32 | atomic_t offset; |
| 33 | atomic_t reserve_count; |
| 34 | atomic_t commit_count; |
| 35 | |
| 36 | atomic_t events_lost; |
| 37 | }; |
| 38 | |
| 39 | struct lttng_trace_info { |
| 40 | int active:1; |
| 41 | int destroy:1; |
| 42 | int filter; |
| 43 | atomic_t nesting; |
| 44 | struct { |
| 45 | struct ltt_buf facilities; |
| 46 | struct ltt_buf cpu; |
| 47 | } channel; |
| 48 | }; |
| 49 | |
| 50 | |
| 51 | void __lttng_sig_trace_handler(int signo); |
| 52 | |
| 53 | /* Call this at the beginning of a new thread, except for the main() */ |
| 54 | void lttng_thread_init(void); |
| 55 | |
| 56 | void lttng_free_trace_info(struct lttng_trace_info *info); |
| 57 | |
| 58 | static inline _syscall1(int, ltt_switch, unsigned long, addr) |
| 59 | static inline _syscall5(int, ltt_update, unsigned long *, cpu_addr, unsigned long *, fac_addr, int *, active, int *, filter, int *, destroy) |
| 60 | |
| 61 | #endif //_LTTNG_USERTRACE_H |