Fix: handle packet_seek errors
[babeltrace.git] / include / babeltrace / error.h
1 #ifndef BABELTRACE_ERROR_H
2 #define BABELTRACE_ERROR_H
3
4 /*
5 * BabelTrace
6 *
7 * Global error accessors.
8 *
9 * Copyright 2018 EfficiOS Inc. and Linux Foundation
10 *
11 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33 /*
34 * bt_packet_seek_get_error: get the return code of the last packet_seek use.
35 *
36 * The packet seek functions defined by the various formats don't return a
37 * value. An implementation that can fail to seek can set a per-thread
38 * packet_seek error to be checked by the caller.
39 *
40 * The error is cleared after access in order to preserve the compatibility
41 * with implementation that don't set an error.
42 */
43 int bt_packet_seek_get_error(void);
44
45 /*
46 * bt_packet_seek_set_error: set the return code of the last packet_seek use.
47 *
48 * This function sets the per-thread packet_seek error. A value of 0 indicates
49 * no error. Implementations of packet_seek are encouraged to use a negative
50 * value to indicate an error.
51 */
52 void bt_packet_seek_set_error(int error);
53
54 #endif /* BABELTRACE_ERROR_H */
This page took 0.030621 seconds and 4 git commands to generate.