error.h 2.2 KB

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