Jeff Hostetler | ee4512e | 2019-02-22 14:25:01 -0800 | [diff] [blame] | 1 | #ifndef TR2_DST_H |
| 2 | #define TR2_DST_H |
| 3 | |
| 4 | struct strbuf; |
Jeff Hostetler | bce9db6 | 2019-04-15 13:39:47 -0700 | [diff] [blame] | 5 | #include "trace2/tr2_sysenv.h" |
Jeff Hostetler | ee4512e | 2019-02-22 14:25:01 -0800 | [diff] [blame] | 6 | |
| 7 | struct tr2_dst { |
Jeff Hostetler | bce9db6 | 2019-04-15 13:39:47 -0700 | [diff] [blame] | 8 | enum tr2_sysenv_variable sysenv_var; |
Jeff Hostetler | ee4512e | 2019-02-22 14:25:01 -0800 | [diff] [blame] | 9 | int fd; |
| 10 | unsigned int initialized : 1; |
| 11 | unsigned int need_close : 1; |
Josh Steadmon | 87db61a | 2019-10-04 15:08:21 -0700 | [diff] [blame] | 12 | unsigned int too_many_files : 1; |
Jeff Hostetler | ee4512e | 2019-02-22 14:25:01 -0800 | [diff] [blame] | 13 | }; |
| 14 | |
| 15 | /* |
| 16 | * Disable TRACE2 on the destination. In TRACE2 a destination (DST) |
| 17 | * wraps a file descriptor; it is associated with a TARGET which |
| 18 | * defines the formatting. |
| 19 | */ |
| 20 | void tr2_dst_trace_disable(struct tr2_dst *dst); |
| 21 | |
| 22 | /* |
| 23 | * Return the file descriptor for the DST. |
| 24 | * If 0, the dst is closed or disabled. |
| 25 | */ |
| 26 | int tr2_dst_get_trace_fd(struct tr2_dst *dst); |
| 27 | |
| 28 | /* |
| 29 | * Return true if the DST is opened for writing. |
| 30 | */ |
| 31 | int tr2_dst_trace_want(struct tr2_dst *dst); |
| 32 | |
| 33 | /* |
| 34 | * Write a single line/message to the trace file. |
| 35 | */ |
| 36 | void tr2_dst_write_line(struct tr2_dst *dst, struct strbuf *buf_line); |
| 37 | |
| 38 | #endif /* TR2_DST_H */ |