| 1 | /* Copyright (C) 2009 Pierre-Marc Fournier |
| 2 | * |
| 3 | * This library is free software; you can redistribute it and/or |
| 4 | * modify it under the terms of the GNU Lesser General Public |
| 5 | * License as published by the Free Software Foundation; either |
| 6 | * version 2.1 of the License, or (at your option) any later version. |
| 7 | * |
| 8 | * This library is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * Lesser General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public |
| 14 | * License along with this library; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | */ |
| 17 | |
| 18 | #ifndef USTD_H |
| 19 | #define USTD_H |
| 20 | |
| 21 | #include "ustcomm.h" |
| 22 | |
| 23 | #define USTD_DEFAULT_TRACE_PATH "/tmp/usttrace" |
| 24 | |
| 25 | struct buffer_info { |
| 26 | const char *name; |
| 27 | pid_t pid; |
| 28 | struct ustcomm_connection conn; |
| 29 | |
| 30 | int shmid; |
| 31 | int bufstruct_shmid; |
| 32 | |
| 33 | /* the buffer memory */ |
| 34 | void *mem; |
| 35 | /* buffer size */ |
| 36 | int memlen; |
| 37 | /* number of subbuffers in buffer */ |
| 38 | int n_subbufs; |
| 39 | /* size of each subbuffer */ |
| 40 | int subbuf_size; |
| 41 | |
| 42 | /* the buffer information struct */ |
| 43 | void *bufstruct_mem; |
| 44 | |
| 45 | int file_fd; /* output file */ |
| 46 | |
| 47 | long consumed_old; |
| 48 | |
| 49 | s64 pidunique; |
| 50 | |
| 51 | /* the offset we must truncate to, to unput the last subbuffer */ |
| 52 | off_t previous_offset; |
| 53 | }; |
| 54 | |
| 55 | void finish_consuming_dead_subbuffer(struct buffer_info *buf); |
| 56 | size_t subbuffer_data_size(void *subbuf); |
| 57 | |
| 58 | #endif /* USTD_H */ |